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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.