DiigIT | IT Community
No Profile Image
Welcome Guest
New User? Register | Login

Need To Upload files with PHP and Ajax

By: Shailesh Singh | 05 Sep 2008 2:29 pm

Hello,
I have a registration page, it is processed to a php script through
ajax and javascript,
The script worked until a input type file is involved

var params = "username=" +
encodeURI(document. getElementById( "usernamee" ).value)+
"&password=" + encodeURI(document. getElementById( "passwordd" ).value)+
"&name=" + encodeURI(document. getElementById( "name").value) +
"&pic=" + pik +
;

As you may see,the value retrived from the input type file with id
and name as pic, this will send a usual $_POST['pic' ] , while I need
to Process _$FILE['pic' ];
How can I send the value of a file
Many Thank

Comments

http://us.php.net/features.file-upload
By: PHP Guru | 05 Sep 2008
you need to include iframe in your application to upload file with ajax.
see this link it will be helpful to you
http://www.anyexamp le.com/programmi ng/php/php_ ajax_example_ _asynchronous_ file_upload. xml
By: Manoj | 08 Sep 2008

Leave a comment

Enter the text in the image
img
Can't read?
Type the characters you see in the picture below.


Close Move