[PHP] uploading files... necessary Ajax?
Hi, a basic question: I want to send a CSV file and some other parameters. In my FORM I have method=POST input type=file and action=http://php;; It sends it to the php file but I don't want the php to be visualized (in fact it just works with the data and inserts in database). I want to keep the original HTML and the php working in the background. Is for that absolutely necessary Ajax? thanks, Pere -- View this message in context: http://www.nabble.com/uploading-files...-necessary-Ajax--tf4849678.html#a13875829 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files... necessary Ajax?
pere roca [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hi, a basic question: I want to send a CSV file and some other parameters. In my FORM I have method=POST input type=file and action=http://php;; It sends it to the php file but I don't want the php to be visualized (in fact it just works with the data and inserts in database). I want to keep the original HTML and the php working in the background. Is for that absolutely necessary Ajax? thanks, Pere -- View this message in context: http://www.nabble.com/uploading-files...-necessary-Ajax--tf4849678.html#a13875829 Sent from the PHP - General mailing list archive at Nabble.com. Hi Why don'tr you upload the file and have a cronjob running in the background, executing the PHP file on command line? That way, the work will get done and the user won't see anything. Just an idea :o) Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files... necessary Ajax?
pere roca wrote: Hi, a basic question: I want to send a CSV file and some other parameters. In my FORM I have method=POST input type=file and action=http://php;; It sends it to the php file but I don't want the php to be visualized (in fact it just works with the data and inserts in database). I want to keep the original HTML and the php working in the background. Is for that absolutely necessary Ajax? no. have a look at the various HTTP status codes you can return to the browser: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html one of the following should do it, although a little further discussion as to which is the best choice (and/or the correct choice) might be worthwhile: 204 No Content 202 Accepted one of the following probably will do it too, although I don't think that their use in the described context is as correct as 204 or 202. 304 Not Modified 201 Created thanks, Pere -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files... necessary Ajax?
On Wed, 21 Nov 2007 14:06:17 +0100, Jochem Maas [EMAIL PROTECTED] wrote: pere roca wrote: Hi, a basic question: I want to send a CSV file and some other parameters. In my FORM I have method=POST input type=file and action=http://php;; It sends it to the php file but I don't want the php to be visualized (in fact it just works with the data and inserts in database). I want to keep the original HTML and the php working in the background. Is for that absolutely necessary Ajax? no. have a look at the various HTTP status codes you can return to the browser: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html one of the following should do it, although a little further discussion as to which is the best choice (and/or the correct choice) might be worthwhile: 204 No Content 202 Accepted one of the following probably will do it too, although I don't think that their use in the described context is as correct as 204 or 202. 304 Not Modified 201 Created Jochem, Just out of interest! How would the upload be performed in the background by sending an HTTP status code? It would still require the page to reload. Wich will not keep the current HTML displayed in the browser. Seems to me Pere want's to do an upload without reloading the whole page. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] uploading files... necessary Ajax?
[snip] Seems to me Pere want's to do an upload without reloading the whole page. [/snip] The problem is that you cannot upload files using Ajax alone. But you can do it without a reload, requires an invisible IFRAME and a little technique. Search Google for several different articles on this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] uploading files... necessary Ajax?
On Wed, 21 Nov 2007 08:38:18 -0600, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] Seems to me Pere want's to do an upload without reloading the whole page. [/snip] The problem is that you cannot upload files using Ajax alone. But you can do it without a reload, requires an invisible IFRAME and a little technique. Search Google for several different articles on this. Indeed uploading with only Ajax is not possible. The already named iframe technique was the only thing i could think of. I was just curious if Jochem knew some other way of tackling this problem. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files... necessary Ajax?
Thanks for the answer, you are right, Jay, I don't want nor reload the page nor a new .php page (the one that works with the data I post) appears. It's difficult to believe that a so dummy thing is not working in php (without Ajax)! I found this URL explaining ajax/php for uploading files. http://www.anyexample.com/programming/php/php_ajax_example__asynchronous_file_upload.xml Pere 2007/11/21, Jay Blanchard [EMAIL PROTECTED]: [snip] Seems to me Pere want's to do an upload without reloading the whole page. [/snip] The problem is that you cannot upload files using Ajax alone. But you can do it without a reload, requires an invisible IFRAME and a little technique. Search Google for several different articles on this.
RE: [PHP] uploading files... necessary Ajax?
You can try this one http://swfupload.mammon.se/ (I didn't try that yet... but planning to do so shortly) Rob -Original Message- From: pere roca ristol [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 21, 2007 12:04 PM To: Jay Blanchard Cc: T.Lensselink; Jochem Maas; php-general@lists.php.net Subject: Re: [PHP] uploading files... necessary Ajax? Thanks for the answer, you are right, Jay, I don't want nor reload the page nor a new .php page (the one that works with the data I post) appears. It's difficult to believe that a so dummy thing is not working in php (without Ajax)! I found this URL explaining ajax/php for uploading files. http://www.anyexample.com/programming/php/php_ajax_example__asynchronou s_file_upload.xml Pere 2007/11/21, Jay Blanchard [EMAIL PROTECTED]: [snip] Seems to me Pere want's to do an upload without reloading the whole page. [/snip] The problem is that you cannot upload files using Ajax alone. But you can do it without a reload, requires an invisible IFRAME and a little technique. Search Google for several different articles on this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php