/    Sign up×
Community /Pin to ProfileBookmark

jquery file upload

hi i am trying to upload a file with jquery but i am failed

here is my code

[code=html]
<script src=”js/jquery.js” language=”javascript”></script>
<script src=”js/jquery.form.js” language=”javascript”></script>
<script language=”javascript”>
function getResult(){
var encoded=document.getElementById(‘file’).value;
//var encoded=encodeURI(text);
$(document).ready(function() {
$(‘#result_query’).html(‘<p style=”text-align:center;”><img src=”images/ajax-loader.gif” width=”220″ height=”19″ /></p>’);

$(‘#result_query’).load(‘ajax.php?query=’+encoded);
});
}
</script>

<p>
<input name=”file” id=”file” type=”file” onchange=”getResult()” />
</p>

[/code]

and the php code

[code=php]

$query=$_REQUEST[‘query’];

$query= $_FILES[$query][“name”];

move_uploaded_file($_FILES[“query”][“tmp_name”],”images/” .$query);

[/code]

when i echo the $queryz with $_REQUEST method variable the variable shown the img name but the $query= $_FILES[$query][“name”]; this thing shown nothing and not upload the file in images folder

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@chrisranjanaMar 26.2011 — You can get some tips from http://www.uploadify.com/
×

Success!

Help @john_angela spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...