Jump to content

[SOLVED] Ajax + Php


Michdd

Recommended Posts

Not really, the problem is javascript can't control the file input (for security reasons), however a workaround would be to put the form in a iframe allows you to stay on the same page.

if your also aiming for a processbar then again no luck php can't read how much data has been processed, a workaround for this is CGI script. and a small ajax to read the data recieved

Link to comment
https://forums.phpfreaks.com/topic/158528-solved-ajax-php/#findComment-836099
Share on other sites

The main point would be to upload/process it without reloading the page. I will have 2 methods of uploading images, from a URL, or from your computer. The URL one works fine because I just send the URL of the input file through ajax to another php file for processing. But this obviously won't work for uploading from a computer. I was also thinking about using an iframe with 0 width/height/border but how would I get it to submit the information to the iframe? If I could do it using GET variables then I could just change the source of the iframe.. but since it'll be using post, I'm a bit confused.

Link to comment
https://forums.phpfreaks.com/topic/158528-solved-ajax-php/#findComment-836119
Share on other sites

I thought I had everything figured out.. But isn't it supposed to send the information to the file? I tried echoing something out like:

 

echo $_FILES['userfile']['name'];

 

Where the form says:

 

<label for="file">File:</label> <input type="file" name="userfile" id="file" />

 

But it's not sending the information..

 

Edit: I forgot:

enctype="multipart/form-data"

Link to comment
https://forums.phpfreaks.com/topic/158528-solved-ajax-php/#findComment-836150
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.