Jump to content

[SOLVED] Upload via Ajax


Northern Flame

Recommended Posts

I want to create a script that will upload an image via ajax.

I know how to do this regularly with PHP, but my question is

if I can upload the file without the user having to click a

"Submit" button. So my question is if i can do something like this:

 

<script type="text/javascript" src="upload_ajax.js"></script>

<!--

the above file will be a simple ajax script that will pass the data

to a php script via $_GET

-->

<input type="file" name="image" size="25" /><br />

<button onClick="uploadImage()">

Upload Image

</button>

 

with the uploadImage() function I can pass the path

of the image on the users computer, but can I then

upload it as I normally would with PHP using $_FILES?

Link to comment
https://forums.phpfreaks.com/topic/101312-solved-upload-via-ajax/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.