Re: [PHP] Uploading files without saving them
On Mon, Jun 23, 2008 at 8:17 PM, Shawn McKenzie <[EMAIL PROTECTED]> wrote: >> > Oooo... where can I get this 'summer.jpg'? It's an Easter Egg embedded in the $_FILES array under an undocumented hidden key. -- Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading files without saving them
Daniel Brown wrote: On Mon, Jun 23, 2008 at 6:05 PM, James Colannino <[EMAIL PROTECTED]> wrote: Ah, I see. What would happen if two people just happened to upload files with the same filename at the same time? Would one stomp over the other, or does PHP have mechanisms to handle that sort of situation? Todd is correct. When you upload a file, it's saved to a temporary directory with a unique filename. Thus, if six people upload the file `summer.jpg`, you may instead see on the server side: /tmp/PHPf983D93j /tmp/PHPOg4ji23 /tmp/PHPeklS83q and so on. Further, as Todd mentioned, unless you explicitly call move_uploaded_files() or perform a similar action, the file will be deleted as soon as the Apache child process dies --- which happens as soon as script execution completes. Keep in mind that this is all assuming that you're using Apache on a *NIX-like system. If you're using IIS, Windows, or anything else, your mileage may vary. Oooo... where can I get this 'summer.jpg'? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading files without saving them
On Mon, Jun 23, 2008 at 6:05 PM, James Colannino <[EMAIL PROTECTED]> wrote: > > Ah, I see. What would happen if two people just happened to upload files > with the same filename at the same time? Would one stomp over the other, or > does PHP have mechanisms to handle that sort of situation? Todd is correct. When you upload a file, it's saved to a temporary directory with a unique filename. Thus, if six people upload the file `summer.jpg`, you may instead see on the server side: /tmp/PHPf983D93j /tmp/PHPOg4ji23 /tmp/PHPeklS83q and so on. Further, as Todd mentioned, unless you explicitly call move_uploaded_files() or perform a similar action, the file will be deleted as soon as the Apache child process dies --- which happens as soon as script execution completes. Keep in mind that this is all assuming that you're using Apache on a *NIX-like system. If you're using IIS, Windows, or anything else, your mileage may vary. -- Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading files without saving them
Nitsan Bin-Nun wrote: PHP uses randomaly name for each of them (during the upload to the temporary directory), when its done PHP moves the file to the objective location, i dont think you will obstacle filename problems. Ah, excellent! Thanks :) James -- My blog: http://www.crazydrclaw.com/ My homepage: http://james.colannino.org/ "Black holes are where God divided by zero." --Steven Wright -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading files without saving them
Boyd, Todd M. wrote: IIRC, if you never move it out of PHP's defaulted temporary storage sandbox, it will eventually be wiped. When files are uploaded via PHP, they must explicitly be moved into the active file system. Ah, I see. What would happen if two people just happened to upload files with the same filename at the same time? Would one stomp over the other, or does PHP have mechanisms to handle that sort of situation? James -- My blog: http://www.crazydrclaw.com/ My homepage: http://james.colannino.org/ "Black holes are where God divided by zero." --Steven Wright -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading files without saving them
> -Original Message- > From: James Colannino [mailto:[EMAIL PROTECTED] > Sent: Monday, June 23, 2008 3:48 PM > To: php-general@lists.php.net > Subject: [PHP] Uploading files without saving them > > Hey everyone. Here's a simple question. I'd like to be able to import > information from a text file located on the client without actually > saving it on the server; that is, I simply want to read the data into > memory on the server, without actually saving it to a file. > > I've been googling around to learn about uploading files via PHP, but > haven't found anything yet (I could save the file to a temporary > location and delete it when finished, but I'd prefer not to have to do > this if at all possible.) > > Anyone have any ideas? Thanks! :) IIRC, if you never move it out of PHP's defaulted temporary storage sandbox, it will eventually be wiped. When files are uploaded via PHP, they must explicitly be moved into the active file system. HTH, Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading files without saving them
Hey everyone. Here's a simple question. I'd like to be able to import information from a text file located on the client without actually saving it on the server; that is, I simply want to read the data into memory on the server, without actually saving it to a file. I've been googling around to learn about uploading files via PHP, but haven't found anything yet (I could save the file to a temporary location and delete it when finished, but I'd prefer not to have to do this if at all possible.) Anyone have any ideas? Thanks! :) James -- My blog: http://www.crazydrclaw.com/ My homepage: http://james.colannino.org/ "Black holes are where God divided by zero." --Steven Wright -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
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
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?
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?
[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 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?
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?
"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
[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 into MySQL
On 5/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I am working on a script to upload files into MySQL db. The following script uploads to a file system how do I go about uploading the file into the DB? Where do I put the SQL statement in the code below? move_uploaded_file($_FILES['myfile']['tmp_name'], "/var/www/".$_FILES['myfile']['name']); Right here you would read the file into a string with file_get_contents(), then write an SQL query to insert the string. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading Files into MySQL
I am working on a script to upload files into MySQL db. The following script uploads to a file system how do I go about uploading the file into the DB? Where do I put the SQL statement in the code below? 10) { die("File exceeds allowed size."); } //check for acceptable file types $file_ext_allowed = array('jpg', 'gif', 'jpeg'); //retrieve the file extension from the uploaded filename $fileext = strtolower(substr($_FILES['myfile']['name'], strrpos($_FILES['myfile']['name'], ".")+1)); if (in_array($fileext, $file_ext_allowed)) { //move the uploaded file to /var/www/ move_uploaded_file($_FILES['myfile']['tmp_name'], "/var/www/".$_FILES['myfile']['name']); } else { echo "File type not allowed"; } } ?> -- ** The content of this e-mail message and any attachments are confidential and may be legally privileged, intended solely for the addressee. If you are not the intended recipient, be advised that any use, dissemination, distribution, or copying of this e-mail is strictly prohibited. If you receive this message in error, please notify the sender immediately by reply email and destroy the message and its attachments. * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files Should I use MySQL or Server for storage?
On Sun, May 20, 2007 10:43 pm, Robert Cummings wrote: > On Sun, 2007-05-20 at 20:35 -0500, Greg Donald wrote: >> On 5/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> > I am in the process of adding a part to my website which would >> include >> > pictures, pdf files, txt files, and excel files. The files sizes >> > could be anywhere on average of 100k to 2mb. Do you think I >> should be >> > uploading the files to a MySQL database or to my server? >> >> >> http://www.zend.com/zend/trick/tricks-sept-2001.php?id=342 >> >> [snip] >> cuts performance by approximately a third >> [/snip] > > Sure, if you use database file storage in the naive way described in > the > document. But I'm quite certain a database stored binary file > dispensed > to multiple servers that keep a locally cached copy for subsequent > requests beats NFS retrieval hands down. Sure, you could do the same > caching with the NFS file but then the solution is quite likely just > as > good as the database storage solution. So the 1/3 performance penalty > is > for the naive solution. Or you could put all the images on a multi-million dollar content-distribution-network of image servers... There are so many ways to skin this cat and make up a "benchmark" to prove whatever you want to prove. So just do whatever makes sense to you for your application at the tim you do it, and accept the consequences, either way, down the road. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files Should I use MySQL or Server for storage?
On Sun, May 20, 2007 8:16 pm, [EMAIL PROTECTED] wrote: > I am in the process of adding a part to my website which would include > pictures, pdf files, txt files, and excel files. The files sizes > could be anywhere on average of 100k to 2mb. Do you think I should be > uploading the files to a MySQL database or to my server? > > I have head that there are pros and cons to both, but have never > really received a definitive answer that helps much. I appreciate all > your opinions on the pros and cons of both. We've pretty much beat this horse to death around here... So I'll try to give just one sample of each: DB PRO: Deleting image data can be simpler. DB CON: Difficult to scale out the DB when it has so much blob data; easy to set up "image server" to segment architecture when it's just a bunch of files to move and a line of PHP code to change the base URL. There are enough fanatics on both sides of this coin... I'm in the "put it in the file system" camp. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files Should I use MySQL or Server for storage?
On Sunday 20 May 2007, Robert Cummings wrote: > On Sun, 2007-05-20 at 23:11 -0500, Larry Garfield wrote: > > A well-optimized and load balanced database-based setup will beat a badly > > configured file system setup, sure. But will it beat a well-optimized > > and load balanced file system setup? I would be very surprised. > > > > Really, it comes down to this, assuming you know what you're doing either > > way. Using a database and PHP access script will add overhead to the > > process. Period. There's extra script execution time, database > > connection time, database read time, and pass-through time. Plus memory > > overhead on all of those, and coding/debugging time and effort. What you > > get in return is more places to programmatically control and log things; > > access-controls for whether or not a user is authorized to see a file, > > potentially more detailed access logs than you can get from simple apache > > logs, etc. > > > > Sometimes that trade-off will be worth it for whatever it is you're > > doing. Most of the time, it probably won't be. Decide based on what it > > is you're doing. > > Yep, I never said database was necessarily superior, only that anyone > with any skill whatsoever isn't going to be hammered by a 1/3 > performance penalty for using the database. As you said... it all > depends on what you're doing. As for all the penalties you mentioned > above, you may be incurring these anyways if you have any kind of > logical control of the files since you probably have to hit the database > for file access permissions, or meta information, etc, etc. On the request to generate the link, yes. But in the browser if it's given, say, an image URL, it has to make a new HTTP request back to the server to get whatever that URL is. If that URL is a PHP script that returns an image out of a database it will be slower than if it's a URL to a file sitting on disk. That's where the performance loss is. Whether or not that's a worthwhile trade-off is a case-by-case question. -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files Should I use MySQL or Server for storage?
On Sun, 2007-05-20 at 23:11 -0500, Larry Garfield wrote: > A well-optimized and load balanced database-based setup will beat a badly > configured file system setup, sure. But will it beat a well-optimized and > load balanced file system setup? I would be very surprised. > > Really, it comes down to this, assuming you know what you're doing either > way. > Using a database and PHP access script will add overhead to the process. > Period. There's extra script execution time, database connection time, > database read time, and pass-through time. Plus memory overhead on all of > those, and coding/debugging time and effort. What you get in return is more > places to programmatically control and log things; access-controls for > whether or not a user is authorized to see a file, potentially more detailed > access logs than you can get from simple apache logs, etc. > > Sometimes that trade-off will be worth it for whatever it is you're doing. > Most of the time, it probably won't be. Decide based on what it is you're > doing. Yep, I never said database was necessarily superior, only that anyone with any skill whatsoever isn't going to be hammered by a 1/3 performance penalty for using the database. As you said... it all depends on what you're doing. As for all the penalties you mentioned above, you may be incurring these anyways if you have any kind of logical control of the files since you probably have to hit the database for file access permissions, or meta information, etc, etc. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files Should I use MySQL or Server for storage?
A well-optimized and load balanced database-based setup will beat a badly configured file system setup, sure. But will it beat a well-optimized and load balanced file system setup? I would be very surprised. Really, it comes down to this, assuming you know what you're doing either way. Using a database and PHP access script will add overhead to the process. Period. There's extra script execution time, database connection time, database read time, and pass-through time. Plus memory overhead on all of those, and coding/debugging time and effort. What you get in return is more places to programmatically control and log things; access-controls for whether or not a user is authorized to see a file, potentially more detailed access logs than you can get from simple apache logs, etc. Sometimes that trade-off will be worth it for whatever it is you're doing. Most of the time, it probably won't be. Decide based on what it is you're doing. On Sunday 20 May 2007, Robert Cummings wrote: > On Sun, 2007-05-20 at 20:35 -0500, Greg Donald wrote: > > On 5/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > I am in the process of adding a part to my website which would include > > > pictures, pdf files, txt files, and excel files. The files sizes > > > could be anywhere on average of 100k to 2mb. Do you think I should be > > > uploading the files to a MySQL database or to my server? > > > > http://www.zend.com/zend/trick/tricks-sept-2001.php?id=342 > > > > [snip] > > cuts performance by approximately a third > > [/snip] > > Sure, if you use database file storage in the naive way described in the > document. But I'm quite certain a database stored binary file dispensed > to multiple servers that keep a locally cached copy for subsequent > requests beats NFS retrieval hands down. Sure, you could do the same > caching with the NFS file but then the solution is quite likely just as > good as the database storage solution. So the 1/3 performance penalty is > for the naive solution. > > Cheers, > Rob. > -- > .. > > | InterJinn Application Framework - http://www.interjinn.com | > | > :: > : > | An application and templating framework for PHP. Boasting | > | a powerful, scalable system for accessing system services | > | such as forms, properties, sessions, and caches. InterJinn | > | also provides an extremely flexible architecture for | > | creating re-usable components quickly and easily. | > > `' -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files Should I use MySQL or Server for storage?
On Sun, 2007-05-20 at 20:35 -0500, Greg Donald wrote: > On 5/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I am in the process of adding a part to my website which would include > > pictures, pdf files, txt files, and excel files. The files sizes > > could be anywhere on average of 100k to 2mb. Do you think I should be > > uploading the files to a MySQL database or to my server? > > > http://www.zend.com/zend/trick/tricks-sept-2001.php?id=342 > > [snip] > cuts performance by approximately a third > [/snip] Sure, if you use database file storage in the naive way described in the document. But I'm quite certain a database stored binary file dispensed to multiple servers that keep a locally cached copy for subsequent requests beats NFS retrieval hands down. Sure, you could do the same caching with the NFS file but then the solution is quite likely just as good as the database storage solution. So the 1/3 performance penalty is for the naive solution. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files Should I use MySQL or Server for storage?
On 5/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: I am in the process of adding a part to my website which would include pictures, pdf files, txt files, and excel files. The files sizes could be anywhere on average of 100k to 2mb. Do you think I should be uploading the files to a MySQL database or to my server? http://www.zend.com/zend/trick/tricks-sept-2001.php?id=342 [snip] cuts performance by approximately a third [/snip] -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files Should I use MySQL or Server for storage?
Thanks Rich. The files are not going to be downloaded all that often and the overall traffic is relatively low. However, as with probably everyone I am hoping and expecting big increases in traffic. I currently run most of my site off LAMP. My main concerns as you mentioned is using memory/CPU bandwidth. There will probably be far more files stored than accessed. Hope this helps everyone else with their opinions. On 5/20/07, Richard Davey <[EMAIL PROTECTED]> wrote: Hi benc11, Monday, May 21, 2007, 2:16:19 AM, you wrote: > I am in the process of adding a part to my website which would include > pictures, pdf files, txt files, and excel files. The files sizes > could be anywhere on average of 100k to 2mb. Do you think I should be > uploading the files to a MySQL database or to my server? > I have head that there are pros and cons to both, but have never > really received a definitive answer that helps much. I appreciate all > your opinions on the pros and cons of both. This isn't a 'one size fits all' question. The pros and cons are specific only to your site. How many uploads are you going to be dealing with, at what frequency, at what growth rate? Are they going to be massively downloaded too? There generally are far less 'pros' for storing binary files in MySQL than you'd think. The only real benefit imho is that they are then filesystem / platform agnostic. There are plenty of 'cons' however. Just think of the server overhead involved in your PHP script talking to MySQL, MySQL sending back the entire file to PHP (using memory / cpu bandwidth), then you've got to blast that file out to the end user. Repeat this X however much traffic you get and you're performing pointless exercises over and over when the web server could just serve the file directly. Only you can answer your question really. Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk "Never trust a computer you can't throw out of a window" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- ** The content of this e-mail message and any attachments are confidential and may be legally privileged, intended solely for the addressee. If you are not the intended recipient, be advised that any use, dissemination, distribution, or copying of this e-mail is strictly prohibited. If you receive this message in error, please notify the sender immediately by reply email and destroy the message and its attachments. * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files Should I use MySQL or Server for storage?
Hi benc11, Monday, May 21, 2007, 2:16:19 AM, you wrote: > I am in the process of adding a part to my website which would include > pictures, pdf files, txt files, and excel files. The files sizes > could be anywhere on average of 100k to 2mb. Do you think I should be > uploading the files to a MySQL database or to my server? > I have head that there are pros and cons to both, but have never > really received a definitive answer that helps much. I appreciate all > your opinions on the pros and cons of both. This isn't a 'one size fits all' question. The pros and cons are specific only to your site. How many uploads are you going to be dealing with, at what frequency, at what growth rate? Are they going to be massively downloaded too? There generally are far less 'pros' for storing binary files in MySQL than you'd think. The only real benefit imho is that they are then filesystem / platform agnostic. There are plenty of 'cons' however. Just think of the server overhead involved in your PHP script talking to MySQL, MySQL sending back the entire file to PHP (using memory / cpu bandwidth), then you've got to blast that file out to the end user. Repeat this X however much traffic you get and you're performing pointless exercises over and over when the web server could just serve the file directly. Only you can answer your question really. Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk "Never trust a computer you can't throw out of a window" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading Files Should I use MySQL or Server for storage?
I am in the process of adding a part to my website which would include pictures, pdf files, txt files, and excel files. The files sizes could be anywhere on average of 100k to 2mb. Do you think I should be uploading the files to a MySQL database or to my server? I have head that there are pros and cons to both, but have never really received a definitive answer that helps much. I appreciate all your opinions on the pros and cons of both. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading files.
On Sat, October 28, 2006 11:47 am, João Cândido de Souza Neto wrote: > I´m in a big doubt about uploading files ins a safe way. > > I wont give permission for the web server user to write in some folder > of my > system and then use move_uploaded_file function in order to keep it > secure. The upload directory should NOT be in your web tree. *BEFORE* you use move_uploaded_file() to put a file into your web tree, you should run every reasonable check you can to prove to yourself that the file is valid format and has content you actually want. If you are on a shared server and don't want PHP to have write access to a directory in your web tree, then don't -- Just move_uploaded_file() to another non web tree directory, and then write a PHP script with http://php.net/readfile or http://php.net/fopen and friends to serve up the files. You can also keep a record in your DB of which files were uploaded, along with some meta-data, so that you can be sure your script only serves up the files you have already vetted. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading files.
Side note on the PHP FTP... I'm sure there are PHP FTP classes out there for you to use... google "php ftp class" and you'll see a few options to explore. On Oct 28, 2006, at 10:47 AM, João Cândido de Souza Neto wrote: Hi everyone. I´m in a big doubt about uploading files ins a safe way. I wont give permission for the web server user to write in some folder of my system and then use move_uploaded_file function in order to keep it secure. I was using ftp functions to do it but a get a new trouble, in some servers my ftp user has no permission to read in the upload temp folder of php. I am determined to access by ftp funcions, give permission to web server user, put the file by move_uploaded_file and take the permission previously gave. I do not test but i think it will works. Someone has another tip to do it without loss security? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading files.
Hi everyone. I´m in a big doubt about uploading files ins a safe way. I wont give permission for the web server user to write in some folder of my system and then use move_uploaded_file function in order to keep it secure. I was using ftp functions to do it but a get a new trouble, in some servers my ftp user has no permission to read in the upload temp folder of php. I am determined to access by ftp funcions, give permission to web server user, put the file by move_uploaded_file and take the permission previously gave. I do not test but i think it will works. Someone has another tip to do it without loss security? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading files / processing with a PHP script
On Sun, October 8, 2006 2:49 pm, Larry Garfield wrote: > The owner of a file can change ownership of the file, too, I believe, > essentially "willing" it to someone else. I sure hope not... Cuz then I could chmod 4777 a file to make it execute as owner, then I could "will" it to 'root' owner, and then I am root. [4### is how you make it "run as user" right?...] Actually, at that point, as it's chmod 777, *every* user on the machine is 'root' as they can cram whatever they want into that file. Total chaos ensues. That would be bad. :-) :-) :-) > A better solution is to set the file's group permissions to 7, then > chown the > file to apache:mygroup, then put both apache and your ftp user into > the > mygroup group. This is a Good Solution, however, and probably most closely resembles the real-world need: www and rpiggot need to be in a common group of users with access to this file. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading files / processing with a PHP script
On Sun, October 8, 2006 7:47 am, Ron Piggott (PHP) wrote: > When I upload a file into an application I am writing with the HTML > form > command > > > > and then give the PHP command > > move_uploaded_file( $userfile , $destination_file_name); > > the owner of the file is 'www'. Is there any way I am able to > automatically change the owner of the file to my FTP login identity > (for > example 'rpiggott') Yes, no, sort of, maybe, and exactly how depends. See, here's the thing. If you, rpiggott, or if www, could just chown (change owner) of any file to anything they wanted, that would be Very Bad. Cuz you could change a file to be owned by 'root', then chmod it to be run *AS* root, and then you essentially *are* 'root'. And that's bad. If you don't know why that's bad, you're way behind on your reading... Anyway, here's what you can do, that should work no matter what else is happening on the machine: User www can make the file world or group readable with http://php.net/chmod when the file is created. If rpiggott and www are in a common group, group readable is enough; If not, you have to use world readable. Use group if you can. Once www's file is readable by rpiggott, then rpiggott can copy the file in a cron job or shell script that www can execute, or... When rpiggott copies www's file into a new file, then rpiggott is creating the file, and it should be owned by rpiggott. Another option, if you happen to have 'root' on the machine (which would be kinda scary given the original question, but there it is) you can make a root-owned script to just chown the files, and run it in a cron job. Before you do all this -- Think carefully. Sometimes changing ownership has broad and drastic implications. You may want to just have www chmod the file so rpiggott can read it or even write it, and then you don't have to go so far as chown. As a general principle, always do the minimum needed to get the task done, when it comes to chmod/chown. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading files / processing with a PHP script
On 10/8/06, Ron Piggott (PHP) <[EMAIL PROTECTED]> wrote: the owner of the file is 'www'. Is there any way I am able to automatically change the owner of the file to my FTP login identity (for example 'rpiggott') Just curious, why do you want to do this? What are you *really* hoping to accomplish? John W Ron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading files / processing with a PHP script
On Sunday 08 October 2006 13:25, Stut wrote: > > the owner of the file is 'www'. Is there any way I am able to > > automatically change the owner of the file to my FTP login identity (for > > example 'rpiggott') > > As far as I am aware only the root user can change the owner of files. > You could set up a very specific sudo command to allow the www user to > chown files to rpiggott but that's beyond the scope of this mailing list > (plus I'd have to look it up and you can do that just as well as I can). > Of course that would need you to have root on the server in the first > place. > > -Stut The owner of a file can change ownership of the file, too, I believe, essentially "willing" it to someone else. Of course, that means your web scripts can't access the file, either. A better solution is to set the file's group permissions to 7, then chown the file to apache:mygroup, then put both apache and your ftp user into the mygroup group. -- Larry Garfield AIM: LOLG42 [EMAIL PROTECTED] ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading files / processing with a PHP script
Ron Piggott (PHP) wrote: When I upload a file into an application I am writing with the HTML form command and then give the PHP command move_uploaded_file( $userfile , $destination_file_name); the owner of the file is 'www'. Is there any way I am able to automatically change the owner of the file to my FTP login identity (for example 'rpiggott') As far as I am aware only the root user can change the owner of files. You could set up a very specific sudo command to allow the www user to chown files to rpiggott but that's beyond the scope of this mailing list (plus I'd have to look it up and you can do that just as well as I can). Of course that would need you to have root on the server in the first place. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading files / processing with a PHP script
When I upload a file into an application I am writing with the HTML form command and then give the PHP command move_uploaded_file( $userfile , $destination_file_name); the owner of the file is 'www'. Is there any way I am able to automatically change the owner of the file to my FTP login identity (for example 'rpiggott') Ron
Re: [PHP] Uploading Files
On Sun, May 21, 2006 3:52 am, P. Guethlein wrote: > I'm at one of those frustration levels can't seem to get a > script working that will post and upload a file to the server. I"m > working with the below. Can you help? > > $numoffile = 1; > >$file_dir = "d:/upload/"; >if ($_FILES['myfiles']) { >print_r ($_FILES); > for ($i=0;$i<$numoffile;$i++) { >if (trim($_FILES['myfiles']['name'][$i])!="") { > $newfile = $file_dir.$_FILES['myfiles']['name'][$i]; > move_uploaded_file($_FILES['myfiles']['tmp_name'][$i], > $newfile); > $j++; >} > } >} >if (isset($j)&&$j>0) print "Your file(s) has been uploaded."; > > echo ' > > > > > Send this file: > > '; > > ?> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading Files - Beginner
Jay, Thanks for the response. I finally found a script that actually worked immediately. I posted the link in an earlier message. I found the authors directly link here http://www.energyscripts.com/Products/product2.html for others that may need help. -Pete At 05:23 PM 05/21/2006, you wrote: [snip] I'm still very frustrated trying to figure out how to upload a file. I must have tried 15 different coding examples and none of them work. When I try and debug and do a print_r($_FILES); All I'm getting back is array() with no data. File upload is allowed in my php.ini Can anyone offer any other insight before my laptop sails into the wall ? [/snip] Have you tried the very simple example shown in the manual? http://us3.php.net/manual/en/features.file-upload.php I will be right by my computer for a while, so make sure to reply to the list. Pay particular attention to MAX_FILE_SIZE. Even if file upload is allowed in you php.in are you running in safe mode? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files - SOLVED
It worked perfectly! ES Simple Uploader Script located at http://www.hotscripts.com/PHP/Scripts_and_Programs/File_Manipulation/Upload_Systems/index.html If anyone else is on their learning curve... -Pete At 04:56 PM 05/21/2006, P. Guethlein wrote: I'm still very frustrated trying to figure out how to upload a file. I must have tried 15 different coding examples and none of them work. When I try and debug and do a print_r($_FILES); All I'm getting back is array() with no data. File upload is allowed in my php.ini Can anyone offer any other insight before my laptop sails into the wall ? Thanks, -Pete At 02:03 PM 05/21/2006, tedd wrote: At 1:52 AM -0700 5/21/06, P. Guethlein wrote: I'm at one of those frustration levels can't seem to get a script working that will post and upload a file to the server. I"m working with the below. Can you help? Guethlein: Yes, try this -- watch for line breaks. Also, create folders "uploads/tmp". The code works "as is" for me except that I have to give the "tmp" folder 0777 permissions* because the code runs as "nobody". I haven't figured out how to get around that, but I can change the uploaded file's permissions without error. (If anyone wants to show me OFF-LIST how to do this without setting the tmp folder to 0777, I'm all ears, but don't beat me up because I'm trying to learn.) Code follows: if (isset($_POST['submit'])) // handle the form -- start of main Submit conditional.. { // Create the file name. $filename = $_FILES['upload']['name']; $file_loaded = 0; // Move the file over. if (move_uploaded_file($_FILES['upload']['tmp_name'], "uploads/tmp/$filename")) { echo 'The file has been uploaded to the server.'; chmod("uploads/tmp/$filename", 0755); echo ( '' . $filename . '' ); } else { echo ('ERROR: The file was not upload.'); } } else { ?> Select the file to upload: File: hth's tedd * Larry Ullman in his books says to use 0777 permission for uploading files. However, he does say that it is less secure and should be placed outside of the web directory. -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading Files - Beginner
[snip] I'm still very frustrated trying to figure out how to upload a file. I must have tried 15 different coding examples and none of them work. When I try and debug and do a print_r($_FILES); All I'm getting back is array() with no data. File upload is allowed in my php.ini Can anyone offer any other insight before my laptop sails into the wall ? [/snip] Have you tried the very simple example shown in the manual? http://us3.php.net/manual/en/features.file-upload.php I will be right by my computer for a while, so make sure to reply to the list. Pay particular attention to MAX_FILE_SIZE. Even if file upload is allowed in you php.in are you running in safe mode? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files - Beginner
I'm still very frustrated trying to figure out how to upload a file. I must have tried 15 different coding examples and none of them work. When I try and debug and do a print_r($_FILES); All I'm getting back is array() with no data. File upload is allowed in my php.ini Can anyone offer any other insight before my laptop sails into the wall ? Thanks, -Pete At 02:03 PM 05/21/2006, tedd wrote: At 1:52 AM -0700 5/21/06, P. Guethlein wrote: I'm at one of those frustration levels can't seem to get a script working that will post and upload a file to the server. I"m working with the below. Can you help? Guethlein: Yes, try this -- watch for line breaks. Also, create folders "uploads/tmp". The code works "as is" for me except that I have to give the "tmp" folder 0777 permissions* because the code runs as "nobody". I haven't figured out how to get around that, but I can change the uploaded file's permissions without error. (If anyone wants to show me OFF-LIST how to do this without setting the tmp folder to 0777, I'm all ears, but don't beat me up because I'm trying to learn.) Code follows: if (isset($_POST['submit'])) // handle the form -- start of main Submit conditional.. { // Create the file name. $filename = $_FILES['upload']['name']; $file_loaded = 0; // Move the file over. if (move_uploaded_file($_FILES['upload']['tmp_name'], "uploads/tmp/$filename")) { echo 'The file has been uploaded to the server.'; chmod("uploads/tmp/$filename", 0755); echo ( '' . $filename . '' ); } else { echo ('ERROR: The file was not upload.'); } } else { ?> Select the file to upload: File: hth's tedd * Larry Ullman in his books says to use 0777 permission for uploading files. However, he does say that it is less secure and should be placed outside of the web directory. -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files
At 1:52 AM -0700 5/21/06, P. Guethlein wrote: I'm at one of those frustration levels can't seem to get a script working that will post and upload a file to the server. I"m working with the below. Can you help? Guethlein: Yes, try this -- watch for line breaks. Also, create folders "uploads/tmp". The code works "as is" for me except that I have to give the "tmp" folder 0777 permissions* because the code runs as "nobody". I haven't figured out how to get around that, but I can change the uploaded file's permissions without error. (If anyone wants to show me OFF-LIST how to do this without setting the tmp folder to 0777, I'm all ears, but don't beat me up because I'm trying to learn.) Code follows: if (isset($_POST['submit'])) // handle the form -- start of main Submit conditional.. { // Create the file name. $filename = $_FILES['upload']['name']; $file_loaded = 0; // Move the file over. if (move_uploaded_file($_FILES['upload']['tmp_name'], "uploads/tmp/$filename")) { echo 'The file has been uploaded to the server.'; chmod("uploads/tmp/$filename", 0755); echo ( '' . $filename . '' ); } else { echo ('ERROR: The file was not upload.'); } } else { ?> Select the file to upload: File: hth's tedd * Larry Ullman in his books says to use 0777 permission for uploading files. However, he does say that it is less secure and should be placed outside of the web directory. -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files
On 5/21/06, P. Guethlein <[EMAIL PROTECTED]> wrote: I'm at one of those frustration levels can't seem to get a script working that will post and upload a file to the server. I"m working with the below. Can you help? 0) print "Your file(s) has been uploaded."; echo ' [snipped] The form's action value should not be __URL__, it should be the actual URL of the PHP file (eg. http://domain.com/upload.php). You can also use the following line instead, which will put in the URL to the current file: Rabin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading Files
I'm at one of those frustration levels can't seem to get a script working that will post and upload a file to the server. I"m working with the below. Can you help? 0) print "Your file(s) has been uploaded."; echo ' Send this file: '; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading files?
Hi list, I am having a little problem with the code below. It just won't seem to work? Even though I always select a jpeg my mime content type test is never true? Have I made a silly mistake somewhere? I also run the test to see if the 'mime_content_type()' function exists first before I do any checking. $uploaddir = 'Uploads/'; $basename = basename($_FILES['userfile']['name']); $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); if (!function_exists('mime_content_type')) { function mime_content_type($f) { $f = escapeshellarg($f); return trim( `file -bi $f` ); } } if(mime_content_type($uploadfile)=="image/jpeg") { if(move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { $_SESSION['UPLOAD_STRING'] = "\"".$basename."\""." is a valid file type and was successfully uploaded."; } else if(strlen($basename)<1) { $_SESSION['UPLOAD_STRING'] = "No file specified, please try again"; } } else $_SESSION['UPLOAD_STRING'] = "File extension not supported, please make sure you use a valid extension."; Cheers, Rory. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] uploading files
Hi, i want to create a form to upload a file on a server. My problem is that i want to check the filesize before sending it because if the filesize is superior than 2 MB it failed and i don't want to wait for a long time for uploading a file that will fail. Can you please give me a solution to check the filesize. Marc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files with a single quote in the filename
On 24 Feb 2005 08:22:39 -0600, Bret Hughes <[EMAIL PROTECTED]> wrote: > On Thu, 2005-02-24 at 01:04, Dotan Cohen wrote: > > > that. A little javascript goes a long way in these sort of situations > > > > You don't want to do that will javascript. I, for one, surf with > > javascript turned off. The malicious script kiddie, I would presume, > > also would be very happy to send you a silly filename without letting > > javascript check it. > Javascript and client-side HTML bounds checking can be very useful. It's a hell of a lot easier to be able to have the web browser tell the user that what they've put in is invalid, rather than have them upload their stuff, have the web server check it all over, and then send back a 'sorry, this is broken' message. Just don't rely on it for security. -- AdamT "Justify my text? I'm sorry, but it has no excuse." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files with a single quote in the filename
On Thu, 2005-02-24 at 01:04, Dotan Cohen wrote: > > that. A little javascript goes a long way in these sort of situations > > You don't want to do that will javascript. I, for one, surf with > javascript turned off. The malicious script kiddie, I would presume, > also would be very happy to send you a silly filename without letting > javascript check it. Very good point. Bret -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files with a single quote in the filename
> that. A little javascript goes a long way in these sort of situations You don't want to do that will javascript. I, for one, surf with javascript turned off. The malicious script kiddie, I would presume, also would be very happy to send you a silly filename without letting javascript check it. Dotan Cohen http://English-Lyrics.com http://Song-Lyriks.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files with a single quote in the filename
On Wed, 2005-02-23 at 18:45, [EMAIL PROTECTED] wrote: > Hi Brett > > My form is effectively identical to yours > > Upload a file: > > No the first part of the file name is just dropped and the file with the > truncated name is saved in the correct place. > > But with it escaping the quote do you mean that you end up with a file with > \ in it? That would be an illegal filename. > > Neil > Yep that is exactly what I mean. Not sure if \it is illegal on a linux box although unusualThe directory separator is /. I am going to be looking at the code soon to try and get a handle on it. At this point I do not know where it is coming from but I should be able to examine the variables that get sent to the server and see where in the browser/php/OS interaction the thing is occurring. I'll let you know. I like allowing users to name files as they will and test all my scripts that handle file names to make sure the handle spaces well but should probably check for a few boneheaded things like that. A little javascript goes a long way in these sort of situations :) Bret -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files with a single quote in the filename
[EMAIL PROTECTED] wrote: Thanks some answers: turning magic quotes on and off seemed to make no difference 1. single quotes aren't important to me but this application allows users to upload photos which often use descriptive filenames which sometimes have single quotes eg. "my mum's car.jpg". I replace the spaces with underscores but I can't get to the filename before the single quote and the text before it have been stripped. 2. the original filename is only important insofar as it often has descriptive information in it. 3. I can't really answer this question very well except to say that it happens in my development environment (IE6 on win2k with apache on win2k) as well as on my hosting server (IE6 on win2k and apache on linux). you're a webdeveloper. please install firefox :-) "Jochem Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi When uploading files using a type=file in a form, if a file is uploaded with a single quote the file gets truncated to whatever is after the quote eg. blah'sblah.txt will be uploaded as sblah.txt Is this a magic quotes issue? I don't think so, test it by turning it on/off. What is the best way to deal with it? couple of questions: 1. are single quotes really necessary in filenames? 2. is the original filename really that important to you? 3. does this happen on just one browser/[client]platform? it could be a browser bug (i.e. it gets stripped on the clientside which would means thats its nothing to do with a PHP bug/setting/feature/misunderstanding/etc) Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files with a single quote in the filename
Hi Brett My form is effectively identical to yours Upload a file: No the first part of the file name is just dropped and the file with the truncated name is saved in the correct place. But with it escaping the quote do you mean that you end up with a file with \ in it? That would be an illegal filename. Neil "Bret Hughes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Wed, 2005-02-23 at 16:40, [EMAIL PROTECTED] wrote: > Thanks Bret > > I have tried turning all reporting on - error_reporting(E_ALL); > but that doesn't reveal anything significant > > I have looked in the logs but there is nothing significant there. > > Because the type is file in the form it is not handled like a post - the > values go into an array called $_FILES > > There seems to be no way to intercept this before the filename gets > truncated > Well for another data point when I uploaded a file using our upload form the ' gets escaped on both IE6 (win98 running in win4lin) and galeon. test's qoutes.jpg becomes test\'s quotes.jpg on a fedora server with apache and php of course. I don't suppose the file gets put into a directory named with the first portion of the file? FWIW here is what my form tag looks like and the filechooser Bret -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files with a single quote in the filename
On Wed, 2005-02-23 at 16:40, [EMAIL PROTECTED] wrote: > Thanks Bret > > I have tried turning all reporting on - error_reporting(E_ALL); > but that doesn't reveal anything significant > > I have looked in the logs but there is nothing significant there. > > Because the type is file in the form it is not handled like a post - the > values go into an array called $_FILES > > There seems to be no way to intercept this before the filename gets > truncated > Well for another data point when I uploaded a file using our upload form the ' gets escaped on both IE6 (win98 running in win4lin) and galeon. test's qoutes.jpg becomes test\'s quotes.jpg on a fedora server with apache and php of course. I don't suppose the file gets put into a directory named with the first portion of the file? FWIW here is what my form tag looks like and the filechooser Bret -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files with a single quote in the filename
Thanks Bret I have tried turning all reporting on - error_reporting(E_ALL); but that doesn't reveal anything significant I have looked in the logs but there is nothing significant there. Because the type is file in the form it is not handled like a post - the values go into an array called $_FILES There seems to be no way to intercept this before the filename gets truncated Thanks again Neil "Bret Hughes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Wed, 2005-02-23 at 06:49, [EMAIL PROTECTED] wrote: > Hi > When uploading files using a type=file in a form, if a file is uploaded with > a single quote the file gets truncated to whatever is after the quote > eg. > blah'sblah.txt > > will be uploaded as > sblah.txt > > Is this a magic quotes issue? > > What is the best way to deal with it? I ran into a similar deal with a textbox and " a while back but I think the issue was sending it back to the browser after the browser sent it up. In the absence of direct help, I would first look to see where the truncation is occurring ie; what is the browser sending? can you post the value and see what your browser is sending it as? is there anything in the logs with error_reporting set to E_ALL? I found trouble shooting the upload process cumbersome since it would fail without any messages but that was before I started setting the error_reporting to also log messages. Not much help but all I got. Bret -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files with a single quote in the filename
Thanks some answers: turning magic quotes on and off seemed to make no difference 1. single quotes aren't important to me but this application allows users to upload photos which often use descriptive filenames which sometimes have single quotes eg. "my mum's car.jpg". I replace the spaces with underscores but I can't get to the filename before the single quote and the text before it have been stripped. 2. the original filename is only important insofar as it often has descriptive information in it. 3. I can't really answer this question very well except to say that it happens in my development environment (IE6 on win2k with apache on win2k) as well as on my hosting server (IE6 on win2k and apache on linux). "Jochem Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: > Hi > When uploading files using a type=file in a form, if a file is uploaded with > a single quote the file gets truncated to whatever is after the quote > eg. > blah'sblah.txt > > will be uploaded as > sblah.txt > > Is this a magic quotes issue? I don't think so, test it by turning it on/off. > > What is the best way to deal with it? couple of questions: 1. are single quotes really necessary in filenames? 2. is the original filename really that important to you? 3. does this happen on just one browser/[client]platform? it could be a browser bug (i.e. it gets stripped on the clientside which would means thats its nothing to do with a PHP bug/setting/feature/misunderstanding/etc) > > Neil > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files with a single quote in the filename
On Wed, 2005-02-23 at 06:49, [EMAIL PROTECTED] wrote: > Hi > When uploading files using a type=file in a form, if a file is uploaded with > a single quote the file gets truncated to whatever is after the quote > eg. > blah'sblah.txt > > will be uploaded as > sblah.txt > > Is this a magic quotes issue? > > What is the best way to deal with it? I ran into a similar deal with a textbox and " a while back but I think the issue was sending it back to the browser after the browser sent it up. In the absence of direct help, I would first look to see where the truncation is occurring ie; what is the browser sending? can you post the value and see what your browser is sending it as? is there anything in the logs with error_reporting set to E_ALL? I found trouble shooting the upload process cumbersome since it would fail without any messages but that was before I started setting the error_reporting to also log messages. Not much help but all I got. Bret -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files with a single quote in the filename
[EMAIL PROTECTED] wrote: Hi When uploading files using a type=file in a form, if a file is uploaded with a single quote the file gets truncated to whatever is after the quote eg. blah'sblah.txt will be uploaded as sblah.txt Is this a magic quotes issue? I don't think so, test it by turning it on/off. What is the best way to deal with it? couple of questions: 1. are single quotes really necessary in filenames? 2. is the original filename really that important to you? 3. does this happen on just one browser/[client]platform? it could be a browser bug (i.e. it gets stripped on the clientside which would means thats its nothing to do with a PHP bug/setting/feature/misunderstanding/etc) Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] uploading files with a single quote in the filename
Hi When uploading files using a type=file in a form, if a file is uploaded with a single quote the file gets truncated to whatever is after the quote eg. blah'sblah.txt will be uploaded as sblah.txt Is this a magic quotes issue? What is the best way to deal with it? Neil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files
try this if($userfile) { if(move_uploaded_file($_FILES ['userfile'], "$uploadpath/$userfile_name")) { echo $userfile_name; echo "Successfully Added!\n"; } else { echo ("error!"); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files
I have updated my script as follows but it still doesn't seem to work: \n"; //$username : contains the name of TMP file, $usrfile_name : it's the real name of file } ?> File to Upload: I get the message that the file has been successfully added, but when I check the location the file doesn't exsit. Any more ideas?? Tom "Rich Gray" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >> if($userfile) { > > copy($userfile, '/home/sites/site176/web/makeit/$userfile_name'); > > echo "Successfully Added!\n"; > > } > > ?> > > > > File to Upload: > > > > > > Hi Tom > > Here's some quick comments.. > > . You need enctype="multipart/form-data" on your form for file uploads > . Watch out for max file size being exceeded -- check the php manual on > 'Handling file uploads' > . If register_globals is off on your server you'd better start looking at > using the $_FILES superglobal (check the manual) > . use move_uploaded_file(...) rather than copy(...) > > HTH > Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading Files
>if($userfile) { > copy($userfile, '/home/sites/site176/web/makeit/$userfile_name'); > echo "Successfully Added!\n"; > } > ?> > > File to Upload: > > Hi Tom Here's some quick comments.. . You need enctype="multipart/form-data" on your form for file uploads . Watch out for max file size being exceeded -- check the php manual on 'Handling file uploads' . If register_globals is off on your server you'd better start looking at using the $_FILES superglobal (check the manual) . use move_uploaded_file(...) rather than copy(...) HTH Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading Files
Hi I am trying to write a cript for some file uploading. So far I have come up wth: \n"; } ?> File to Upload: This seems to be fine except it cannot seem to find the file its trying to upload. It says it doesn't exsist. Can anybody see a reason why?? Tom Wollaston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files!
Dimitri Marshall wrote: Hi there, I'm new to this new PHP thing and man it's frusterating. Anyway, I'm not gonna tell you my life story, but I just need to know how to allow users to upload files to my server . I've already made a form with the Thanks in advance, Dimitri Marshall Try using $_FILES or $HTTP_POST_FILES and make sure you have |enctype="multipart/form-data" in your form tag.| - rob -- [EMAIL PROTECTED] http://www.phpexamples.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
AW: [PHP] Uploading Files!
Hi Dimitri, > I'm new to this new PHP thing and man it's frusterating. Anyway, I'm not > gonna tell you my life story, but I just need to know how to allow users > to > upload files to my server . I've already made a form with the name="whatever" type="file" and then a program that should get the > varibles > [name] and [tmp_name] using $_POST. For some reason it's not working. > Could > someone tell me how to do it, or what I'm doing wrong? [Daniel Diehl] Take a look at http://www.php.net/manual/en/features.file-upload.php . I think this will solve your problem. You have to set the enctype "enctype="multipart/form-data"" in the form tag. Greet, Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading Files!
Hi there, I'm new to this new PHP thing and man it's frusterating. Anyway, I'm not gonna tell you my life story, but I just need to know how to allow users to upload files to my server . I've already made a form with the http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading files via SSH
Google for "Failed to scan directories. Error 6" (including quotes). First result is the ssh.com faq, which has a link to http://www.ssh.com/support/faq/secureshell/qa_1_1198.html, which is your answer On Wednesday 03 September 2003 11:39 pm, Ben C. wrote: > This is not a PHP question but didn't know where else to ask it. I am > uploading files via SSH Secure File Transfer and am getting the following > error message. > > --error message start-- > Failed to scan directories. Error 6: C:/Documents and Settings/My > Documents/My Webs/dynamic/1.php: No such file or directory.. > DONE - 0 Files0 Total > Encountered 1 errors. > --error message stop-- > > Does anyone know why I am getting this message. It only happens when I am > trying to add a file to a directory. Any advice or help is appreciated. > > Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading files via SSH
This is not a PHP question but didn't know where else to ask it. I am uploading files via SSH Secure File Transfer and am getting the following error message. --error message start-- Failed to scan directories. Error 6: C:/Documents and Settings/My Documents/My Webs/dynamic/1.php: No such file or directory.. DONE - 0 Files 0 Total Encountered 1 errors. --error message stop-- Does anyone know why I am getting this message. It only happens when I am trying to add a file to a directory. Any advice or help is appreciated. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading files time out every so often
Well I have built a script that is responsible for upload 20Mb of files at a time. The possible probs are 1) A short disconnetion in the net connection can cause the upload to stall 2) Sometimes when I visit / post data on the same domain, the upload stalls where as if I just leave that upload be and continue surfing on other sites, it generally runs ok to the end. 3) Free space - wierd things happen when PHP is unable to write files on the server (like your disk quota gets used up) 4) Check ifyour server has enough bandwidth to manage so many uploads at once. Make sure the server does not get disconnected (This is unlikely, but never the less check) Hope it helps. All the best. - Sid - Original Message - From: "Ivo Pletikosic" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, July 03, 2003 11:29 AM Subject: [PHP] Uploading files time out every so often > Hello, > > I am currently involved in a site where users frequently need to upload text > files of various sizes. Every so often users will experience problems where > the uploads will start timing-out and need to be reinitiated. > > The timeout problem comes and goes, so far I've been unable to find the root > cause. It happens with files of all sizes, from 10k to several MB, > eventually they all get uploaded, tho sometimes it can take days re-trying. > > Another issue is experienced when the above symptom is happening which makes > me think they're related. An additional tool on the site writes out files > with information provided by a user thru a form. A user submits a form with > some text and php writes out a file with the received info and notifies the > user the task was done. Every so often the browser will timeout with no file > written out by php or notification. This symptom can go on for days. The > info being written to a file is never longer than a dozen lines of text so > it's quite small. > > Initially we thought that the server just did not have the resources to > service simultaneous uploads but monitoring tools show the cpu appears to be > near idle when this is experienced. I've experienced the file writing > problem when I was the only user on the server with all unnecessary services > disabled. The browser will just time out, then one days voila! it works > until the next problem day. > > This is on a Linux box with Apache 1.3, php 4.2.2 & experienced across > multiple browsers. All the scripts have set_time_limit(0). File system has > the proper permissions and with plenty of free space. > > We've been collecting quite a lot of info from the server to try to capture > it's state at the time of the problem but nothing raises any flags. > > Has anyone experienced this issue or a similar issue? Any pointers and help > is greatly appreciated. > > Ivo > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading files time out every so often
Hello, I am currently involved in a site where users frequently need to upload text files of various sizes. Every so often users will experience problems where the uploads will start timing-out and need to be reinitiated. The timeout problem comes and goes, so far I've been unable to find the root cause. It happens with files of all sizes, from 10k to several MB, eventually they all get uploaded, tho sometimes it can take days re-trying. Another issue is experienced when the above symptom is happening which makes me think they're related. An additional tool on the site writes out files with information provided by a user thru a form. A user submits a form with some text and php writes out a file with the received info and notifies the user the task was done. Every so often the browser will timeout with no file written out by php or notification. This symptom can go on for days. The info being written to a file is never longer than a dozen lines of text so it's quite small. Initially we thought that the server just did not have the resources to service simultaneous uploads but monitoring tools show the cpu appears to be near idle when this is experienced. I've experienced the file writing problem when I was the only user on the server with all unnecessary services disabled. The browser will just time out, then one days voila! it works until the next problem day. This is on a Linux box with Apache 1.3, php 4.2.2 & experienced across multiple browsers. All the scripts have set_time_limit(0). File system has the proper permissions and with plenty of free space. We've been collecting quite a lot of info from the server to try to capture it's state at the time of the problem but nothing raises any flags. Has anyone experienced this issue or a similar issue? Any pointers and help is greatly appreciated. Ivo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files after passing vars between forms
I didn't know that Thanks for the info. "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Don't forget uploaded files are removed after confirmation.php finishes. > You need to move them to a temporary directory. > > Artoo wrote: > > Hey > > > > I'm confused! > > > > Do I use move_uploaded_file() or copy() and what is the first parameter of > > both in the following case: > > > > form portion of upload.htm > > -- > > > ACTION="confirmation.php" METHOD="POST" onSubmit="return validate()" > > > > > > > > > > > > > > > Upload.htm asks for the image to be uploaded and passes of to > > confirmation.php which allows the user to either send the photo or go back > > and change the photo. and uses hidden values to pass the variables form > > upload.htm > > > > form prortion of confirmation.php > > > > > > ";?> > > > > > type="button" name="edit" value="Chage the photo" onClick="history.go(-1)"> > > > > > > > > > > > > > > > > > > > > > > > > > > Then send_file.php first cheks to see if the user had pressed the "send to > > server" button. I still have to work on the "Change the photo" button. > > > > If "send to server" was pressed, 'send_file.php' first checks to see if that > > file already exists on the server. If it does it displays a message to the > > user. If it does not exist, the file is copied onto the server. > > > > send_file.php > > > > > > PHP: > > -- -- > > -- > > > >> $file_path = $path."/images/".$file_name; > > if($_POST['send_photo']) > > { > > if (file_exists($file_path)) > > { > > ?> , already > > exists. > > > } > > if ( copy($file_name, $file_path) ) > >{ > >?>Thank you for . Your uload has > > succesfully uploaded. >} > >else > >{ > > print "ERROR"; > > exit(); > >} > > } > > > > -- -- > > -- > > > > > > > > I get " Warning: Unable to open '' for reading: No such file or > > directory..." > > > > I did have print statements for each of the vars being passed into > > send_file.php to make sure they were seen. And they were. > > > > What fucntion should I use the move_uploaded_file() or copy() and what's the > > function's first argument so that the file is copied to the server? > > > > Thanks > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] uploading files after passing vars between forms
- Original Message - From: "Artoo" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 12, 2003 10:16 AM Subject: [PHP] uploading files after passing vars between forms > Hey > > I'm confused! > > Do I use move_uploaded_file() or copy() and what is the first parameter of > both in the following case: > ... SNIP... > I get " Warning: Unable to open '' for reading: No such file or > directory..." > > I did have print statements for each of the vars being passed into > send_file.php to make sure they were seen. And they were. > > What fucntion should I use the move_uploaded_file() or copy() and what's the > function's first argument so that the file is copied to the server? > > Thanks Hi, Your problem isn't your code, it's your method. The temp file is automatically deleted after confirmation.php dies. Therefore by the time you send the tmp_name through to the send_file.php it no longer exists. What you're going to have to do is copy() the tmp file to a permenant location within confirmation.php. And then post that information to send_file.php with an added subroutine to delete the file if the user goes back to change some info. Confirmations are normally only used durring descructive actions so you may consider ditching the confirmation screen all together. HTH, Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files after passing vars between forms
Don't forget uploaded files are removed after confirmation.php finishes. You need to move them to a temporary directory. Artoo wrote: Hey I'm confused! Do I use move_uploaded_file() or copy() and what is the first parameter of both in the following case: form portion of upload.htm -- ACTION="confirmation.php" METHOD="POST" onSubmit="return validate()" > Upload.htm asks for the image to be uploaded and passes of to confirmation.php which allows the user to either send the photo or go back and change the photo. and uses hidden values to pass the variables form upload.htm form prortion of confirmation.php ";?> type="button" name="edit" value="Chage the photo" onClick="history.go(-1)"> Then send_file.php first cheks to see if the user had pressed the "send to server" button. I still have to work on the "Change the photo" button. If "send to server" was pressed, 'send_file.php' first checks to see if that file already exists on the server. If it does it displays a message to the user. If it does not exist, the file is copied onto the server. send_file.php PHP: -- , already exists. Thank you for . Your uload has succesfully uploaded. -- I get " Warning: Unable to open '' for reading: No such file or directory..." I did have print statements for each of the vars being passed into send_file.php to make sure they were seen. And they were. What fucntion should I use the move_uploaded_file() or copy() and what's the function's first argument so that the file is copied to the server? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] uploading files after passing vars between forms
Hey I'm confused! Do I use move_uploaded_file() or copy() and what is the first parameter of both in the following case: form portion of upload.htm -- Upload.htm asks for the image to be uploaded and passes of to confirmation.php which allows the user to either send the photo or go back and change the photo. and uses hidden values to pass the variables form upload.htm form prortion of confirmation.php ";?> Then send_file.php first cheks to see if the user had pressed the "send to server" button. I still have to work on the "Change the photo" button. If "send to server" was pressed, 'send_file.php' first checks to see if that file already exists on the server. If it does it displays a message to the user. If it does not exist, the file is copied onto the server. send_file.php PHP: -- , already exists. Thank you for . Your uload has succesfully uploaded.http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading Files Via PHP
Or you could just do it correctly the first time and be done with it. :) -Original Message- From: Philip J. Newman [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 10:23 AM To: Jennifer Goodie; Dan Rossi; [EMAIL PROTECTED] Subject: Re: [PHP] Uploading Files Via PHP You could chnage the permissions when you want to write something then change it back when your done. Thats what i do. / Phil - Original Message - From: "Jennifer Goodie" <[EMAIL PROTECTED]> To: "Dan Rossi" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, March 28, 2003 6:17 AM Subject: RE: [PHP] Uploading Files Via PHP > A world writeable directory is a security risk. Why not just fix the > owner/group and only give the permissions needed, 775 at most. > > -Original Message- > From: Dan Rossi [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 27, 2003 1:45 AM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Uploading Files Via PHP > > > did u even read it ? chmod 777 + owned by httpd > > -Original Message- > From: Jason Wong [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 27, 2003 9:40 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Uploading Files Via PHP > > > On Thursday 27 March 2003 18:25, Marek Kilimajer wrote: > > not necesserily both, either of them is enought: > > Not quite true :) > > If owned by 'httpd' then 'httpd' still needs write permission (o+w). > > > drwxrwxrwt2 root root 188416 Mar 27 11:23 /tmp > > or > > drwx--2 apache apache 188416 Mar 27 11:23 > > /var/www/uploads > > > > daniel wrote: > > >possibly a permissions problem , dir needs to be 777 and owned by httpd > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > -- > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > -- > /* > In good speaking, should not the mind of the speaker know the truth of > the matter about which he is to speak? > -- Plato > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files Via PHP
You could chnage the permissions when you want to write something then change it back when your done. Thats what i do. / Phil - Original Message - From: "Jennifer Goodie" <[EMAIL PROTECTED]> To: "Dan Rossi" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, March 28, 2003 6:17 AM Subject: RE: [PHP] Uploading Files Via PHP > A world writeable directory is a security risk. Why not just fix the > owner/group and only give the permissions needed, 775 at most. > > -Original Message- > From: Dan Rossi [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 27, 2003 1:45 AM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Uploading Files Via PHP > > > did u even read it ? chmod 777 + owned by httpd > > -Original Message- > From: Jason Wong [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 27, 2003 9:40 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Uploading Files Via PHP > > > On Thursday 27 March 2003 18:25, Marek Kilimajer wrote: > > not necesserily both, either of them is enought: > > Not quite true :) > > If owned by 'httpd' then 'httpd' still needs write permission (o+w). > > > drwxrwxrwt2 root root 188416 Mar 27 11:23 /tmp > > or > > drwx--2 apache apache 188416 Mar 27 11:23 > > /var/www/uploads > > > > daniel wrote: > > >possibly a permissions problem , dir needs to be 777 and owned by httpd > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > -- > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > -- > /* > In good speaking, should not the mind of the speaker know the truth of > the matter about which he is to speak? > -- Plato > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading Files Via PHP
A world writeable directory is a security risk. Why not just fix the owner/group and only give the permissions needed, 775 at most. -Original Message- From: Dan Rossi [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 1:45 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Uploading Files Via PHP did u even read it ? chmod 777 + owned by httpd -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 9:40 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Uploading Files Via PHP On Thursday 27 March 2003 18:25, Marek Kilimajer wrote: > not necesserily both, either of them is enought: Not quite true :) If owned by 'httpd' then 'httpd' still needs write permission (o+w). > drwxrwxrwt2 root root 188416 Mar 27 11:23 /tmp > or > drwx--2 apache apache 188416 Mar 27 11:23 > /var/www/uploads > > daniel wrote: > >possibly a permissions problem , dir needs to be 777 and owned by httpd -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* In good speaking, should not the mind of the speaker know the truth of the matter about which he is to speak? -- Plato */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files Via PHP
By apache I ment the httpd process's user. I don't mean your way won't work, but you give away unnecessary permissions - if the directory is owned by httpd, access rights 700 are enough, if the directory is not owned by httpd, you need at least 007 Dan Rossi wrote: did u even read it ? chmod 777 + owned by httpd -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 9:40 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Uploading Files Via PHP On Thursday 27 March 2003 18:25, Marek Kilimajer wrote: not necesserily both, either of them is enought: Not quite true :) If owned by 'httpd' then 'httpd' still needs write permission (o+w). drwxrwxrwt2 root root 188416 Mar 27 11:23 /tmp or drwx--2 apache apache 188416 Mar 27 11:23 /var/www/uploads daniel wrote: possibly a permissions problem , dir needs to be 777 and owned by httpd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading Files Via PHP
did u even read it ? chmod 777 + owned by httpd -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 9:40 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Uploading Files Via PHP On Thursday 27 March 2003 18:25, Marek Kilimajer wrote: > not necesserily both, either of them is enought: Not quite true :) If owned by 'httpd' then 'httpd' still needs write permission (o+w). > drwxrwxrwt2 root root 188416 Mar 27 11:23 /tmp > or > drwx--2 apache apache 188416 Mar 27 11:23 > /var/www/uploads > > daniel wrote: > >possibly a permissions problem , dir needs to be 777 and owned by httpd -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* In good speaking, should not the mind of the speaker know the truth of the matter about which he is to speak? -- Plato */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files Via PHP
On Thursday 27 March 2003 18:25, Marek Kilimajer wrote: > not necesserily both, either of them is enought: Not quite true :) If owned by 'httpd' then 'httpd' still needs write permission (o+w). > drwxrwxrwt2 root root 188416 Mar 27 11:23 /tmp > or > drwx--2 apache apache 188416 Mar 27 11:23 > /var/www/uploads > > daniel wrote: > >possibly a permissions problem , dir needs to be 777 and owned by httpd -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* In good speaking, should not the mind of the speaker know the truth of the matter about which he is to speak? -- Plato */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files Via PHP
not necesserily both, either of them is enought: drwxrwxrwt2 root root 188416 Mar 27 11:23 /tmp or drwx--2 apache apache 188416 Mar 27 11:23 /var/www/uploads daniel wrote: possibly a permissions problem , dir needs to be 777 and owned by httpd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading Files Via PHP
possibly a permissions problem , dir needs to be 777 and owned by httpd >= Original Message From "Jennifer Goodie" <[EMAIL PROTECTED]> = >http://www.php.net/manual/en/features.file-upload.php > >From the page listed above: "Related Configurations Note: See also the >file_uploads, upload_max_filesize, upload_tmp_dir, and post_max_size >directives in php.ini" > >I would read that manual page as it deals with file uploading support. > >-Original Message- >From: Vernon [mailto:[EMAIL PROTECTED] >Sent: Wednesday, March 26, 2003 4:41 PM >To: [EMAIL PROTECTED] >Subject: [PHP] Uploading Files Via PHP > > >Is there some thing that needs to be turned on in the php.ini in order to be >able to upload photos VIA php? I have the same script on one machine with >the right permissions on the upload dirs on one machine and am moving to >another machine which is not being uploaded. Funny thing is I'm not getting >any errors in the Apache logs. > >Thanks > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading Files Via PHP
http://www.php.net/manual/en/features.file-upload.php >From the page listed above: "Related Configurations Note: See also the file_uploads, upload_max_filesize, upload_tmp_dir, and post_max_size directives in php.ini" I would read that manual page as it deals with file uploading support. -Original Message- From: Vernon [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 26, 2003 4:41 PM To: [EMAIL PROTECTED] Subject: [PHP] Uploading Files Via PHP Is there some thing that needs to be turned on in the php.ini in order to be able to upload photos VIA php? I have the same script on one machine with the right permissions on the upload dirs on one machine and am moving to another machine which is not being uploaded. Funny thing is I'm not getting any errors in the Apache logs. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files Via PHP
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Are you getting any errors through PHP? Set error reporting to E_ALL then try. On Wednesday 26 March 2003 04:41 pm, Vernon wrote: > Is there some thing that needs to be turned on in the php.ini in order to > be able to upload photos VIA php? I have the same script on one machine > with the right permissions on the upload dirs on one machine and am moving > to another machine which is not being uploaded. Funny thing is I'm not > getting any errors in the Apache logs. > > Thanks - -- All religions are founded on the fear of the many and the cleverness of the few. - -Stendhal -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE+glMF/rncFku1MdIRAlN5AJ9n6jN4N8dLQg8OVLZZClgSEJ+qEwCffq6f XRmpe/CK1i1ecaHRh7t+eLQ= =snmO -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading Files Via PHP
Is there some thing that needs to be turned on in the php.ini in order to be able to upload photos VIA php? I have the same script on one machine with the right permissions on the upload dirs on one machine and am moving to another machine which is not being uploaded. Funny thing is I'm not getting any errors in the Apache logs. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files and MAX_FILE_SIZE and php.ini
On Friday 14 February 2003 03:17, David T-G wrote: > Mike, et al -- > > ...and then Mike Kercher said... > % > % You might also check out your timeout value in php.ini This should not have an effect because PHP only starts executing *after* the file has been fully uploaded. > I'll definitely need to tweak that for the real world, but this was > locally on a laptop. It was fun to watch the two drive lights flash back > and forth as I watched my free space go down by 200M or so :-) -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Q: Why did the astrophysicist order three hamburgers? A: Because he was hungry. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files and MAX_FILE_SIZE and php.ini
Hi again -- ...and then David T-G said... % ... % Ahhh... After reading it *twice* I realized that I'm using method='post' % and so I need to set post_max_size as well. I've now confirmed that I % can upload multiple MAX_FILE_SIZE files up to post_max_size :-) Oh, yeah -- and now I need to see if I can override php.ini settings in my script because the production server is set to 2M :-) Thanks again & HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg96856/pgp0.pgp Description: PGP signature
Re: [PHP] uploading files and MAX_FILE_SIZE and php.ini
Mike, et al -- ...and then Mike Kercher said... % % You might also check out your timeout value in php.ini I'll definitely need to tweak that for the real world, but this was locally on a laptop. It was fun to watch the two drive lights flash back and forth as I watched my free space go down by 200M or so :-) Thanks & HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg96855/pgp0.pgp Description: PGP signature
Re: [PHP] uploading files and MAX_FILE_SIZE and php.ini
Jason, et al -- ...and then Jason Wong said... % % On Friday 14 February 2003 02:44, David T-G wrote: % % > Yes, I'm back again with another upload question. I promise I've been % > paying attention in class, but I just can't get this to work! % % [snip] % % > Now I'm at a loss for where to turn to fix this. It would seem that % > everything is in place! Is there an apache directive that I need as % > well, perhaps? % % manual > Handling file uploads > Common Pitfalls Ahhh... After reading it *twice* I realized that I'm using method='post' and so I need to set post_max_size as well. I've now confirmed that I can upload multiple MAX_FILE_SIZE files up to post_max_size :-) Yeah, I feel stupid, but I'm happy :-) % % -- % Jason Wong -> Gremlins Associates -> www.gremlins.biz Thanks again! & HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg96854/pgp0.pgp Description: PGP signature
RE: [PHP] uploading files and MAX_FILE_SIZE and php.ini
You might also check out your timeout value in php.ini -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 13, 2003 12:57 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] uploading files and MAX_FILE_SIZE and php.ini On Friday 14 February 2003 02:44, David T-G wrote: > Yes, I'm back again with another upload question. I promise I've been > paying attention in class, but I just can't get this to work! [snip] > Now I'm at a loss for where to turn to fix this. It would seem that > everything is in place! Is there an apache directive that I need as > well, perhaps? manual > Handling file uploads > Common Pitfalls -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* So this is what it feels like to be potato salad */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files and MAX_FILE_SIZE and php.ini
On Friday 14 February 2003 02:44, David T-G wrote: > Yes, I'm back again with another upload question. I promise I've been > paying attention in class, but I just can't get this to work! [snip] > Now I'm at a loss for where to turn to fix this. It would seem that > everything is in place! Is there an apache directive that I need as > well, perhaps? manual > Handling file uploads > Common Pitfalls -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* So this is what it feels like to be potato salad */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] uploading files and MAX_FILE_SIZE and php.ini
Hi, all -- Yes, I'm back again with another upload question. I promise I've been paying attention in class, but I just can't get this to work! The default upload_max_filesize in my php.ini was 2M, but I changed it to 200M and restarted the server, and now phpinfo() reports 200M. I created a dinky little upload form, which is attached, to either accept an upload or tell me that it got one, and I can successfully upload files of 7M (much bigger than the original 2M). After initial failures, I added a hidden form field MAX_FILE_SIZE as has been suggested (but sometimes contested) in other posts. I still cannot, however, upload anything larger; a 9M file as well as some 30M and 40M tests just doesn't appear. I have only 5-10M of my 256M available, but I have 90M of swap free and over 1G free on /, the monolithic root partition. Now I'm at a loss for where to turn to fix this. It would seem that everything is in place! Is there an apache directive that I need as well, perhaps? TIA & HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! Send me some files! " ; #print(exec("id")); ### #phpinfo() ; ### if ( $_FILES[uploads] ) { print "I HAVE _FILES!\n" ; ### print "\n";### print_r($_FILES); print "\n"; ### } else { print " OK, buddy. Time to send me some files. " ; } print " " ; ?> msg96845/pgp0.pgp Description: PGP signature
[PHP] uploading files
I am attempting to upload image files to the server from a users browser using the following code, however, the images seem to get corrupted, they look completely different and the file sizes are generally smaller, also it sometimes says file upload unsuccessful, even when it does upload the file? Any ideas? Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files
How are you deleting the file? How are you moving the temp file to the permanent area? Are you sure it's not a browser cache issue? ---John Holmes... - Original Message - From: "Donahue Ben" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, October 07, 2002 1:22 PM Subject: [PHP] uploading files > I am uploading a gif file using > is_upload_file($filename) function. > I save the file with a file name img1.gif. It seems > to work fine. But when I delete the file img1.gif > then upload a different gif file and save it as > img1.gif, it displays the first image i uploaded not > the most recent one, why is this? Is there a way to > get around it? > > Ben > > __ > Do you Yahoo!? > Faith Hill - Exclusive Performances, Videos & More > http://faith.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] uploading files
I am uploading a gif file using is_upload_file($filename) function. I save the file with a file name img1.gif. It seems to work fine. But when I delete the file img1.gif then upload a different gif file and save it as img1.gif, it displays the first image i uploaded not the most recent one, why is this? Is there a way to get around it? Ben __ Do you Yahoo!? Faith Hill - Exclusive Performances, Videos & More http://faith.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files
on 05/10/02 5:53 AM, Jason ([EMAIL PROTECTED]) wrote: > I would like to be able to upload files from the client computer to the > server via a form. I know how to build the form, but am not sure of the > best way to process this. I know there are certain ftp functions that can > do this, which I'm not sure how to use. Are there any others? There's a perfect working example in the manual: http://www.php.net/manual/en/features.file-upload.php Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading Files
I would like to be able to upload files from the client computer to the server via a form. I know how to build the form, but am not sure of the best way to process this. I know there are certain ftp functions that can do this, which I'm not sure how to use. Are there any others? Jason D. Williard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading files
Well, apparently $_POST[passcodeFile] is empty. The first question that comes to mind is whether you have the correct array index there. The second is why do you need the double quotes surrounding it. You should try echoing $_POST[passcodeFile] and see if it contains anything. Bogdan Tyler Longren wrote: >Hello, > >I usually use this code to upload files when I have a form with type=file name=passcodeFile> > >It no longer works for some reason: >$data = fread(fopen("$_POST[passcodeFile]", "r"), >filesize("$_POST[passcodeFile]")); > >Here are the errors that it produces: >Warning: fopen("", "r") - Success in >/usr/local/apache/htdocs/cj/aanr/admin/passcode_admin.php on line 146 > >Warning: stat failed for (errno=2 - No such file or directory) in >/usr/local/apache/htdocs/cj/aanr/admin/passcode_admin.php on line 146 > >Warning: fread(): supplied argument is not a valid File-Handle resource >in /usr/local/apache/htdocs/cj/aanr/admin/passcode_admin.php on line 146 > >The "$data =" line is line number 146. Does anyone seen anything wrong >with this? > >Thanks, > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading files
Hello, I usually use this code to upload files when I have a form with It no longer works for some reason: $data = fread(fopen("$_POST[passcodeFile]", "r"), filesize("$_POST[passcodeFile]")); Here are the errors that it produces: Warning: fopen("", "r") - Success in /usr/local/apache/htdocs/cj/aanr/admin/passcode_admin.php on line 146 Warning: stat failed for (errno=2 - No such file or directory) in /usr/local/apache/htdocs/cj/aanr/admin/passcode_admin.php on line 146 Warning: fread(): supplied argument is not a valid File-Handle resource in /usr/local/apache/htdocs/cj/aanr/admin/passcode_admin.php on line 146 The "$data =" line is line number 146. Does anyone seen anything wrong with this? Thanks, -- Tyler Longren Captain Jack Communications [EMAIL PROTECTED] www.captainjack.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files problem
specify the value attribute in input elements!!! - Original Message - From: "Balaji Ankem" <[EMAIL PROTECTED]> Date: Friday, March 29, 2002 4:27 pm Subject: Re: [PHP] uploading files problem > hi friend, > > do we have static variables in php? > > If we have can u give the syntax!!1 > > Thanks in advance > Balaji > Content-Type: multiparboundary=" > _=_NextPart_001_01C1D70D.F3519000" > > --_=_NextPart_001_01C1D70D.F3519000 > Content-Type: text/plain > > hi there, > > I'm trying to upload a file using php on an apache server running on > linux. > > The code of the form I'm using is as follow: > > action=$PHP_SELF?action=doupload > > File to upload: > > > > Upload > > > > > when I press the submit button after selecting the file, nothing > happens. > I tried to print the filename passed by the form but it is empty. > If I run the same page on my win2k server, everything works fine. > It seems as that the form doesn't pass post variables. I also > tried to > delete the enctype parameter and in this case the variables are > printedon screen. > > Is there any particular setting on linux for this page to work? > > thanks > > > > > --_=_NextPart_001_01C1D70D.F3519000-- > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php **Disclaimer Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading files problem
hi friend, do we have static variables in php? If we have can u give the syntax!!1 Thanks in advance Balaji Content-Type: multipart/alternative; boundary="_=_NextPart_001_01C1D70D.F3519000" --_=_NextPart_001_01C1D70D.F3519000 Content-Type: text/plain hi there, I'm trying to upload a file using php on an apache server running on linux. The code of the form I'm using is as follow: File to upload: Upload when I press the submit button after selecting the file, nothing happens. I tried to print the filename passed by the form but it is empty. If I run the same page on my win2k server, everything works fine. It seems as that the form doesn't pass post variables. I also tried to delete the enctype parameter and in this case the variables are printed on screen. Is there any particular setting on linux for this page to work? thanks --_=_NextPart_001_01C1D70D.F3519000-- **Disclaimer Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php