[PHP] Uploading a file through PHP form
How do you upload a file using PHP? Also what is the web page which describes the procedure on php.net ? Thanks, Ron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading a file through PHP form
Try checking out this manual page: http://us3.php.net/features.file-upload It includes pretty much everything you'll need to know. --Ben On Dec 13, 2007 9:03 PM, Ron Piggott [EMAIL PROTECTED] wrote: How do you upload a file using PHP? Also what is the web page which describes the procedure on php.net ? Thanks, Ron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Benjamin [EMAIL PROTECTED] Dream as if you'll live forever, live as if you'll die today. ~James Dean
RE: [PHP] Uploading a file through PHP form
Hi Ron, http://www.php.net/manual/en/features.file-upload.php is the page its pretty simple Bastien From: [EMAIL PROTECTED] To: php-general@lists.php.net Date: Thu, 13 Dec 2007 21:03:00 -0500 Subject: [PHP] Uploading a file through PHP form How do you upload a file using PHP? Also what is the web page which describes the procedure on php.net ? Thanks, Ron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Exercise your brain! Try Flexicon! http://puzzles.sympatico.msn.ca/chicktionary/index.html?icid=htmlsig
[PHP] Uploading Image File
Morning all. I would like to know if anybody could e-mail an example of code to upload files into a MySQL server using PHP from a form. Thanks a lot. Best Regards, RENZO CLAVIJO
Re: [PHP] Uploading Image File
Morning all. I would like to know if anybody could e-mail an example of code to upload files into a MySQL server using PHP from a form. Thanks a lot. Best Regards, RENZO CLAVIJO What exactly do you mean? Best regards /Gustav Wiberg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Image File
Renzo Clavijo wrote: Morning all. I would like to know if anybody could e-mail an example of code to upload files into a MySQL server using PHP from a form. recently a new phenomenon has appeared online, namely search engines: http://www.google.com/search?num=100q=php+upload+image+example+mysql Thanks a lot. Best Regards, RENZO CLAVIJO -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading a file
Hi I have recently been working on a site which allows the user to upload a file to the site. Originally calling the $_FILES['file']['tmp_name'] worked fine, however the web host has now disabled all global variables and if I'm not mistaken $_FILES is global. Does anyone know of a work around for this? Cheers. Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading a File
On Sat, 26 Feb 2005 23:04:59 -0700, Jason Bennett [EMAIL PROTECTED] wrote: Hi all, I'm having this problem trying to upload a file using PHP. I am using Apache (compiled from source) and PHP 5.0.3 The entire contents of the page is: form method=post enctype=multipart/form-data action=/upload.php INPUT TYPE=hidden name=MAX_FILE_SIZE value=52428800 input type=file name=myfile input type=submit value=Begin Upload /form The entire script is: ?php $uploaddir = /tmp; $uploadfile = $uploaddir . uploaded.file; if (move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile)) { echo Complete.; } else { echo No Upload.; } ? The returned message I get is: Notice: Undefined index: myfile in /www/htdocs/upload.php on line 6 No Upload. I've checked $_FILES['myfile']['error'] and its empty. The whole $_FILES array is empty. In my php.ini file I have the following: ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). upload_tmp_dir = /tmp ; Maximum allowed size for uploaded files. upload_max_filesize = 50M -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You might want to just use my TerribleFile script: http://dotancohen.com/terriblefile Even if you don't use it, you can look at the code for ideas. Enjoy. 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 a File
were those two sections in the same file? entire contents and entire script can be a bit unclear. if they are in the same file... u might want to put an if (!empty($_FILES['myfile']['name'])) { //second section that handles files upload // the $uploaddir = /tmp; part } it would be good to give ur submit button a name: input type=submit name=submit_button_name value=Begin Upload ...so u can use it as if (isset($_POST['submit_button_name'])) { // 2nd section as above } On Sat, 26 Feb 2005 23:04:59 -0700, Jason Bennett [EMAIL PROTECTED] wrote: Hi all, I'm having this problem trying to upload a file using PHP. I am using Apache (compiled from source) and PHP 5.0.3 The entire contents of the page is: form method=post enctype=multipart/form-data action=/upload.php INPUT TYPE=hidden name=MAX_FILE_SIZE value=52428800 input type=file name=myfile input type=submit value=Begin Upload /form The entire script is: ?php $uploaddir = /tmp; $uploadfile = $uploaddir . uploaded.file; if (move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile)) { echo Complete.; } else { echo No Upload.; } ? The returned message I get is: Notice: Undefined index: myfile in /www/htdocs/upload.php on line 6 No Upload. I've checked $_FILES['myfile']['error'] and its empty. The whole $_FILES array is empty. In my php.ini file I have the following: ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). upload_tmp_dir = /tmp ; Maximum allowed size for uploaded files. upload_max_filesize = 50M -- ]# Anirudh Dutt ...pilot of the storm who leaves no trace like thoughts inside a dream -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading a File
Hi all, I'm having this problem trying to upload a file using PHP. I am using Apache (compiled from source) and PHP 5.0.3 The entire contents of the page is: form method=post enctype=multipart/form-data action=/upload.php INPUT TYPE=hidden name=MAX_FILE_SIZE value=52428800 input type=file name=myfile input type=submit value=Begin Upload /form The entire script is: ?php $uploaddir = /tmp; $uploadfile = $uploaddir . uploaded.file; if (move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile)) { echo Complete.; } else { echo No Upload.; } ? The returned message I get is: Notice: Undefined index: myfile in /www/htdocs/upload.php on line 6 No Upload. I've checked $_FILES['myfile']['error'] and its empty. The whole $_FILES array is empty. In my php.ini file I have the following: ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). upload_tmp_dir = /tmp ; Maximum allowed size for uploaded files. upload_max_filesize = 50M -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading a File Solution
Sorry all, I found the problem. I had put in an entry in post_max_size as 2G however PHP seems to think that meant 2 bytes. I lowered it down to something reasonable in M and it worked fine. I'm not sure if that is a bug or not regardless of whether or not 2G is smart for that variable, it took it as 2 bytes either way. Cheers, J. -Original Message- From: Jason Bennett [mailto:[EMAIL PROTECTED] Sent: Saturday, February 26, 2005 11:05 PM To: php-general@lists.php.net Subject: [PHP] Uploading a File Hi all, I'm having this problem trying to upload a file using PHP. I am using Apache (compiled from source) and PHP 5.0.3 The entire contents of the page is: form method=post enctype=multipart/form-data action=/upload.php INPUT TYPE=hidden name=MAX_FILE_SIZE value=52428800 input type=file name=myfile input type=submit value=Begin Upload /form The entire script is: ?php $uploaddir = /tmp; $uploadfile = $uploaddir . uploaded.file; if (move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile)) { echo Complete.; } else { echo No Upload.; } ? The returned message I get is: Notice: Undefined index: myfile in /www/htdocs/upload.php on line 6 No Upload. I've checked $_FILES['myfile']['error'] and its empty. The whole $_FILES array is empty. In my php.ini file I have the following: ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). upload_tmp_dir = /tmp ; Maximum allowed size for uploaded files. upload_max_filesize = 50M -- 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 a file to server behind a firewall
I am trying to upload a file to a server behind a firewall. Notes It works fine from inside the firewall. I access the server and run the following ?php phpinfo(); ? Bug when I run the following code. It works in from within the firewall. But not from outside. I have port forwarding turned on obviously. But is there anything else that I need to do. Any help would be much appreciated. Thanks Rick Laird ?php if ($HTTP_POST_VARS['action']) { ? !-- Code to process Uploaded File and Display -- !-- The HTML to display the results -- ? BRA HREF=?php echo $PHP_SELF ?Back/A /FONT/P /BODY /HTML ?php } else { ? HTML HEAD TITLEFile Upload/TITLE /HEAD BODY BGCOLOR=WHITE TEXT=BLACK PFONT FACE=Arial, Helvetica, sans-serifFONT SIZE=+1File Upload/FONTBRBR FORM METHOD=POST ENCTYPE=multipart/form-data ACTION=?php echo $PHP_SELF;? INPUT TYPE=HIDDEN NAME=MAX_FILE_SIZE VALUE=80 INPUT TYPE=HIDDEN NAME=action VALUE=1 File 1: INPUT TYPE=FILE NAME=file1 SIZE=30BRBR INPUT TYPE=SUBMIT VALUE=Upload /FORM /FONT/P /BODY /HTML ?php } ? ?php if ($HTTP_POST_VARS['action']) { ? HTML HEAD TITLEFile Upload Results/TITLE /HEAD BODY BGCOLOR=WHITE TEXT=BLACK PFONT FACE=Arial, Helvetica, sans-serifFONT SIZE=+1File Upload Results/FONTBRBR ?php $uploadpath = '/files/'; $source = $HTTP_POST_FILES['file1']['tmp_name']; $dest = $uploadpath.$HTTP_POST_FILES['file1']['name']; if ( move_uploaded_file( $source, $dest ) ) { echo 'File successfully stored.BR'; } else { echo 'File could not be stored.BR'; } ? BRA HREF=?php echo $PHP_SELF ?Back/A /FONT/P /BODY /HTML ?php } else { ? !-- File Upload Form HTML Code Here -- ?php } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading a file from a form
Hi, Friday, July 25, 2003, 1:48:50 AM, you wrote: AM I am having a problem with uploading a file from a form. I changed the AM permission on the directory, but I am still getting an error. Here is my AM error: AM Copy failed./home/vencel/www/images/apt/company_logo/14Update Failed! AM It looks like it's not finding the file type. Here is my code: AM ? include(../includes/database.php); ? AM ? AM $long_path = /home/vencel/www/images/apt/; AM $short_path = ../images/apt/; AM if (($REQUEST_METHOD=='POST')) { AMfor(reset($HTTP_POST_VARS); AM $key=key($HTTP_POST_VARS); AM next($HTTP_POST_VARS)) { AM $this = addslashes($HTTP_POST_VARS[$key]); AM $this = strtr($this, , ); AM $this = strtr($this, , ); AM $this = strtr($this, |, ); AM $$key = $this; AM} AM //Check for form fields, insert them. AM //Pull out the id auto-incremented from previous insert. AM //Check to see if a full-sized photo was uploaded AM if ($photo == none) { AM echo No photo.; AM } else { AM $end = strrchr($photo_name, .); AM echo $end; AM $new_photo_name = $company_id[0] . $end; AM if ([EMAIL PROTECTED]($photo, $long_path . company_logo/ . $photo_name)) { AM echo Copy failed.; AM echo $long_path . company_logo/ . $photo_name; AM echo $new_photo_name; AM } else { AM $long_photo_path = $long_path . company_logo/ . $new_photo_name; AM $photo_path = $short_path . company_logo/ . $new_photo_name; AM if ([EMAIL PROTECTED]($long_path . logo/ . $photo_name, AM$long_photo_path)){ AMecho Full sized photo not renamed.; AM } AM } AM } AM $add_image_query .= UPDATE apt_company_t set AM company_logo_path='$photo_path', ; AM $add_image_query .= WHERE company_cd = $company_id[0]; AM mysql_query($add_image_query) or die(Update Failed!); AM } } ? AM FORM METHOD=post ACTION=? echo $PHP_SELF ? AM table AM TR AM td colspan = 2BUse the iBrowse/i button to locate your file on AM your computer or local network./B/td/tr AM tr AM tdCompany Logo File: /tdtdinput type=file name=photo size=30/td/tr AM tr AM td colspan=2 align=centerINPUT TYPE=submit VALUE=Add/td AM /tr AM /table AM /FORM AM Any ideas? The first thing is to add ENCTYPE=multipart/form-data to the form tag. FORM ENCTYPE=multipart/form-data METHOD=post ACTION=? echo $PHP_SELF ? Then the rest will depend on what version of php you have. It may be worth doing print_r($_FILES); to see if that is available. -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading a file from a form
The version is PHP Version 4.2.3. On Tue, 29 Jul 2003, Tom Rogers wrote: Hi, Friday, July 25, 2003, 1:48:50 AM, you wrote: AM I am having a problem with uploading a file from a form. I changed the AM permission on the directory, but I am still getting an error. Here is my AM error: AM Copy failed./home/vencel/www/images/apt/company_logo/14Update Failed! AM It looks like it's not finding the file type. Here is my code: AM ? include(../includes/database.php); ? AM ? AM $long_path = /home/vencel/www/images/apt/; AM $short_path = ../images/apt/; AM if (($REQUEST_METHOD=='POST')) { AMfor(reset($HTTP_POST_VARS); AM $key=key($HTTP_POST_VARS); AM next($HTTP_POST_VARS)) { AM $this = addslashes($HTTP_POST_VARS[$key]); AM $this = strtr($this, , ); AM $this = strtr($this, , ); AM $this = strtr($this, |, ); AM $$key = $this; AM} AM //Check for form fields, insert them. AM //Pull out the id auto-incremented from previous insert. AM //Check to see if a full-sized photo was uploaded AM if ($photo == none) { AM echo No photo.; AM } else { AM $end = strrchr($photo_name, .); AM echo $end; AM $new_photo_name = $company_id[0] . $end; AM if ([EMAIL PROTECTED]($photo, $long_path . company_logo/ . $photo_name)) { AM echo Copy failed.; AM echo $long_path . company_logo/ . $photo_name; AM echo $new_photo_name; AM } else { AM $long_photo_path = $long_path . company_logo/ . $new_photo_name; AM $photo_path = $short_path . company_logo/ . $new_photo_name; AM if ([EMAIL PROTECTED]($long_path . logo/ . $photo_name, AM$long_photo_path)){ AMecho Full sized photo not renamed.; AM } AM } AM } AM $add_image_query .= UPDATE apt_company_t set AM company_logo_path='$photo_path', ; AM $add_image_query .= WHERE company_cd = $company_id[0]; AM mysql_query($add_image_query) or die(Update Failed!); AM } } ? AM FORM METHOD=post ACTION=? echo $PHP_SELF ? AM table AM TR AM td colspan = 2BUse the iBrowse/i button to locate your file on AM your computer or local network./B/td/tr AM tr AM tdCompany Logo File: /tdtdinput type=file name=photo size=30/td/tr AM tr AM td colspan=2 align=centerINPUT TYPE=submit VALUE=Add/td AM /tr AM /table AM /FORM AM Any ideas? The first thing is to add ENCTYPE=multipart/form-data to the form tag. FORM ENCTYPE=multipart/form-data METHOD=post ACTION=? echo $PHP_SELF ? Then the rest will depend on what version of php you have. It may be worth doing print_r($_FILES); to see if that is available. -- regards, Tom -- 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[2]: [PHP] uploading a file from a form
Hi, Wednesday, July 30, 2003, 12:09:44 AM, you wrote: AM The version is PHP Version 4.2.3. AM On Tue, 29 Jul 2003, Tom Rogers wrote: Then you can use the $_FILES array like this: if($_FILES[photo][error]==0){ //make sure no errors on upload if(!empty($_FILES[photo][name])){ //do we have a file name $tempname = $_FILES[photo][tmp_name]; //this is how php has it $file = trim($_FILES[photo][name]); //this is what it was called //clean up the file name //we don't want something like this is mac's image.jpg $file = ereg_replace(',,$file); $file = ereg_replace(%20,_,$file); $file = ereg_replace( ,_,$file); $path = '/home/vencel/www/images/apt'; //this is where we want to store //make sure that apt has permissions set to 777 so web user //can write to it move_uploaded_file($tempname,$file); } } -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading a file from a form
I'm not sure what that means...how do I use it, and where? On Fri, 25 Jul 2003, Marek Kilimajer wrote: Don't you need to use $HTTP_POST_FILES array because you have register_globals off? Amanda McComb wrote: I am having a problem with uploading a file from a form. I changed the permission on the directory, but I am still getting an error. Here is my error: Copy failed./home/vencel/www/images/apt/company_logo/14Update Failed! It looks like it's not finding the file type. Here is my code: ? include(../includes/database.php); ? ? $long_path = /home/vencel/www/images/apt/; $short_path = ../images/apt/; if (($REQUEST_METHOD=='POST')) { for(reset($HTTP_POST_VARS); $key=key($HTTP_POST_VARS); next($HTTP_POST_VARS)) { $this = addslashes($HTTP_POST_VARS[$key]); $this = strtr($this, , ); $this = strtr($this, , ); $this = strtr($this, |, ); $$key = $this; } //Check for form fields, insert them. //Pull out the id auto-incremented from previous insert. //Check to see if a full-sized photo was uploaded if ($photo == none) { echo No photo.; } else { $end = strrchr($photo_name, .); echo $end; $new_photo_name = $company_id[0] . $end; if ([EMAIL PROTECTED]($photo, $long_path . company_logo/ . $photo_name)) { echo Copy failed.; echo $long_path . company_logo/ . $photo_name; echo $new_photo_name; } else { $long_photo_path = $long_path . company_logo/ . $new_photo_name; $photo_path = $short_path . company_logo/ . $new_photo_name; if ([EMAIL PROTECTED]($long_path . logo/ . $photo_name, $long_photo_path)){ echo Full sized photo not renamed.; } } } $add_image_query .= UPDATE apt_company_t set company_logo_path='$photo_path', ; $add_image_query .= WHERE company_cd = $company_id[0]; mysql_query($add_image_query) or die(Update Failed!); } } ? FORM METHOD=post ACTION=? echo $PHP_SELF ? table TR td colspan = 2BUse the iBrowse/i button to locate your file on your computer or local network./B/td/tr tr tdCompany Logo File: /tdtdinput type=file name=photo size=30/td/tr tr td colspan=2 align=centerINPUT TYPE=submit VALUE=Add/td /tr /table /FORM Any ideas? -- 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 a file from a form
Everything is in the manual: http://www.php.net/features.file-upload Amanda McComb wrote: I'm not sure what that means...how do I use it, and where? On Fri, 25 Jul 2003, Marek Kilimajer wrote: Don't you need to use $HTTP_POST_FILES array because you have register_globals off? Amanda McComb wrote: I am having a problem with uploading a file from a form. I changed the permission on the directory, but I am still getting an error. Here is my error: Copy failed./home/vencel/www/images/apt/company_logo/14Update Failed! It looks like it's not finding the file type. Here is my code: ? include(../includes/database.php); ? ? $long_path = /home/vencel/www/images/apt/; $short_path = ../images/apt/; if (($REQUEST_METHOD=='POST')) { for(reset($HTTP_POST_VARS); $key=key($HTTP_POST_VARS); next($HTTP_POST_VARS)) { $this = addslashes($HTTP_POST_VARS[$key]); $this = strtr($this, , ); $this = strtr($this, , ); $this = strtr($this, |, ); $$key = $this; } //Check for form fields, insert them. //Pull out the id auto-incremented from previous insert. //Check to see if a full-sized photo was uploaded if ($photo == none) { echo No photo.; } else { $end = strrchr($photo_name, .); echo $end; $new_photo_name = $company_id[0] . $end; if ([EMAIL PROTECTED]($photo, $long_path . company_logo/ . $photo_name)) { echo Copy failed.; echo $long_path . company_logo/ . $photo_name; echo $new_photo_name; } else { $long_photo_path = $long_path . company_logo/ . $new_photo_name; $photo_path = $short_path . company_logo/ . $new_photo_name; if ([EMAIL PROTECTED]($long_path . logo/ . $photo_name, $long_photo_path)){ echo Full sized photo not renamed.; } } } $add_image_query .= UPDATE apt_company_t set company_logo_path='$photo_path', ; $add_image_query .= WHERE company_cd = $company_id[0]; mysql_query($add_image_query) or die(Update Failed!); } } ? FORM METHOD=post ACTION=? echo $PHP_SELF ? table TR td colspan = 2BUse the iBrowse/i button to locate your file on your computer or local network./B/td/tr tr tdCompany Logo File: /tdtdinput type=file name=photo size=30/td/tr tr td colspan=2 align=centerINPUT TYPE=submit VALUE=Add/td /tr /table /FORM Any ideas? -- 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 a file from a form
Amanda, You need to look at some of the error messages that are available to you: 1) remove the prepended @ from the file functions. This will tell what is going wrong with the file copy. if ([EMAIL PROTECTED]($photo, $long_path . company_logo/ . $photo_name)) { echo Copy failed.; 2) use mysql_error() when you sql query fails rather than just die() ing $add_image_query .= UPDATE apt_company_t set company_logo_path='$photo_path', ; $add_image_query .= WHERE company_cd = $company_id[0]; mysql_query($add_image_query) or die(Update Failed!); As Curt Zirzow has suggested, it looks to me like your mysql syntax is at fault here. mysql_error() will have told you about it. You have a ', ' where you shouldn't have one Martin - Original Message - From: Marek Kilimajer [EMAIL PROTECTED] To: Amanda McComb [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, July 28, 2003 3:43 PM Subject: Re: [PHP] uploading a file from a form Everything is in the manual: http://www.php.net/features.file-upload Amanda McComb wrote: I'm not sure what that means...how do I use it, and where? On Fri, 25 Jul 2003, Marek Kilimajer wrote: Don't you need to use $HTTP_POST_FILES array because you have register_globals off? Amanda McComb wrote: I am having a problem with uploading a file from a form. I changed the permission on the directory, but I am still getting an error. Here is my error: Copy failed./home/vencel/www/images/apt/company_logo/14Update Failed! It looks like it's not finding the file type. Here is my code: ? include(../includes/database.php); ? ? $long_path = /home/vencel/www/images/apt/; $short_path = ../images/apt/; if (($REQUEST_METHOD=='POST')) { for(reset($HTTP_POST_VARS); $key=key($HTTP_POST_VARS); next($HTTP_POST_VARS)) { $this = addslashes($HTTP_POST_VARS[$key]); $this = strtr($this, , ); $this = strtr($this, , ); $this = strtr($this, |, ); $$key = $this; } //Check for form fields, insert them. //Pull out the id auto-incremented from previous insert. //Check to see if a full-sized photo was uploaded if ($photo == none) { echo No photo.; } else { $end = strrchr($photo_name, .); echo $end; $new_photo_name = $company_id[0] . $end; if ([EMAIL PROTECTED]($photo, $long_path . company_logo/ . $photo_name)) { echo Copy failed.; echo $long_path . company_logo/ . $photo_name; echo $new_photo_name; } else { $long_photo_path = $long_path . company_logo/ . $new_photo_name; $photo_path = $short_path . company_logo/ . $new_photo_name; if ([EMAIL PROTECTED]($long_path . logo/ . $photo_name, $long_photo_path)){ echo Full sized photo not renamed.; } } } $add_image_query .= UPDATE apt_company_t set company_logo_path='$photo_path', ; $add_image_query .= WHERE company_cd = $company_id[0]; mysql_query($add_image_query) or die(Update Failed!); } } ? FORM METHOD=post ACTION=? echo $PHP_SELF ? table TR td colspan = 2BUse the iBrowse/i button to locate your file on your computer or local network./B/td/tr tr tdCompany Logo File: /tdtdinput type=file name=photo size=30/td/tr tr td colspan=2 align=centerINPUT TYPE=submit VALUE=Add/td /tr /table /FORM Any ideas? -- 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 a file from a form
Don't you need to use $HTTP_POST_FILES array because you have register_globals off? Amanda McComb wrote: I am having a problem with uploading a file from a form. I changed the permission on the directory, but I am still getting an error. Here is my error: Copy failed./home/vencel/www/images/apt/company_logo/14Update Failed! It looks like it's not finding the file type. Here is my code: ? include(../includes/database.php); ? ? $long_path = /home/vencel/www/images/apt/; $short_path = ../images/apt/; if (($REQUEST_METHOD=='POST')) { for(reset($HTTP_POST_VARS); $key=key($HTTP_POST_VARS); next($HTTP_POST_VARS)) { $this = addslashes($HTTP_POST_VARS[$key]); $this = strtr($this, , ); $this = strtr($this, , ); $this = strtr($this, |, ); $$key = $this; } //Check for form fields, insert them. //Pull out the id auto-incremented from previous insert. //Check to see if a full-sized photo was uploaded if ($photo == none) { echo No photo.; } else { $end = strrchr($photo_name, .); echo $end; $new_photo_name = $company_id[0] . $end; if ([EMAIL PROTECTED]($photo, $long_path . company_logo/ . $photo_name)) { echo Copy failed.; echo $long_path . company_logo/ . $photo_name; echo $new_photo_name; } else { $long_photo_path = $long_path . company_logo/ . $new_photo_name; $photo_path = $short_path . company_logo/ . $new_photo_name; if ([EMAIL PROTECTED]($long_path . logo/ . $photo_name, $long_photo_path)){ echo Full sized photo not renamed.; } } } $add_image_query .= UPDATE apt_company_t set company_logo_path='$photo_path', ; $add_image_query .= WHERE company_cd = $company_id[0]; mysql_query($add_image_query) or die(Update Failed!); } } ? FORM METHOD=post ACTION=? echo $PHP_SELF ? table TR td colspan = 2BUse the iBrowse/i button to locate your file on your computer or local network./B/td/tr tr tdCompany Logo File: /tdtdinput type=file name=photo size=30/td/tr tr td colspan=2 align=centerINPUT TYPE=submit VALUE=Add/td /tr /table /FORM Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading a file from a form
* Thus wrote Amanda McComb ([EMAIL PROTECTED]): mysql_query($add_image_query) or die(Update Failed!); Print out the $add_image_query to see whats wrong with it. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] uploading a file from a form
I am having a problem with uploading a file from a form. I changed the permission on the directory, but I am still getting an error. Here is my error: Copy failed./home/vencel/www/images/apt/company_logo/14Update Failed! It looks like it's not finding the file type. Here is my code: ? include(../includes/database.php); ? ? $long_path = /home/vencel/www/images/apt/; $short_path = ../images/apt/; if (($REQUEST_METHOD=='POST')) { for(reset($HTTP_POST_VARS); $key=key($HTTP_POST_VARS); next($HTTP_POST_VARS)) { $this = addslashes($HTTP_POST_VARS[$key]); $this = strtr($this, , ); $this = strtr($this, , ); $this = strtr($this, |, ); $$key = $this; } //Check for form fields, insert them. //Pull out the id auto-incremented from previous insert. //Check to see if a full-sized photo was uploaded if ($photo == none) { echo No photo.; } else { $end = strrchr($photo_name, .); echo $end; $new_photo_name = $company_id[0] . $end; if ([EMAIL PROTECTED]($photo, $long_path . company_logo/ . $photo_name)) { echo Copy failed.; echo $long_path . company_logo/ . $photo_name; echo $new_photo_name; } else { $long_photo_path = $long_path . company_logo/ . $new_photo_name; $photo_path = $short_path . company_logo/ . $new_photo_name; if ([EMAIL PROTECTED]($long_path . logo/ . $photo_name, $long_photo_path)){ echo Full sized photo not renamed.; } } } $add_image_query .= UPDATE apt_company_t set company_logo_path='$photo_path', ; $add_image_query .= WHERE company_cd = $company_id[0]; mysql_query($add_image_query) or die(Update Failed!); } } ? FORM METHOD=post ACTION=? echo $PHP_SELF ? table TR td colspan = 2BUse the iBrowse/i button to locate your file on your computer or local network./B/td/tr tr tdCompany Logo File: /tdtdinput type=file name=photo size=30/td/tr tr td colspan=2 align=centerINPUT TYPE=submit VALUE=Add/td /tr /table /FORM Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading a file from a specific directory
With : FORM ENCTYPE=multipart/form-data ACTION=_URL_ METHOD=POST ... Envoyez ce fichier : INPUT NAME=userfile TYPE=file ... /FORM Is there a parameter wich indicates the directory where the file must be uploaded ? For example, from the root of my site. Thank You -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading a file from a specific directory
With : FORM ENCTYPE=multipart/form-data ACTION=_URL_ METHOD=POST ... Envoyez ce fichier : INPUT NAME=userfile TYPE=file ... /FORM Is there a parameter wich indicates the directory where the file must be uploaded ? The file is uploaded to the directory specified in php.ini. You must move/copy it from there before the script ends. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] uploading a file via php - i need some simple code
I am having the worst trouble trying to write a tiny simple script that will upload a file. Below is my code - can anyone tell me why it's not working HTML form name=form1 method=post action=upload.php enctype=multipart/form-data input type=hidden name=MAX_FILE_SIZE value=1000 input type=file name=userfile input type=submit name=Submit value=Submit /form PHP (upload.php) $filename = /test.txt; if (!move_uploaded_file($userfile, $filename)) { echo something barfed.; exit; } else { echo uploaded.; } Something is most likely wrong with the $filename variable. I don't know what exactly to put in there. All I want to do is upload a file and then move/copy it to a specific directory. What am I doing wrong?!?! THANKS!!
Re: [PHP] uploading a file via php - i need some simple code
From: Phil Schwarzmann [EMAIL PROTECTED] I am having the worst trouble trying to write a tiny simple script that will upload a file. Below is my code - can anyone tell me why it's not working HTML form name=form1 method=post action=upload.php enctype=multipart/form-data input type=hidden name=MAX_FILE_SIZE value=1000 [snip] Without looking at your other code, I'll just point out that the value for MAX_FILE_SIZE is in bytes, so you're specifying a very small files size as your max. Perhaps you're off by a few magnitudes. For example, 24576000 would be the value for a 24Mb max size. -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] uploading a file
Balaji, I tried to implement the code you put in this email and I'm having some problems. I am able to browse and choose a file from my system then click upload. The php script doesn't get the value of $path. The site is running PHP 4.2.1 on Windows NT 5.0. I am using Internet Explorer 6.0.26. Any suggestions on what I need to add? Thanx, Bev -Original Message- From: Balaji Ankem [mailto:[EMAIL PROTECTED]] Sent: Monday, July 01, 2002 12:11 PM To: 'Phil Schwarzmann' Cc: [EMAIL PROTECTED] Subject: RE: [PHP] uploading a file Upload.html === !DOCTYPE html public -//w3c//dtd html 4.0 transitional//en HTML TITLE FileUpload /TITLE head script language=Javascript function check() { document.upload.method = POST; document.upload.enctype='multipart/form-data' document.upload.action=upload.php; document.upload.submit(); return true; } /script /head BODY center form name=upload Onsubmit=return check() enctype='multipart/form-data' brbrbrbr table border=0 width=100% trtd width=30% align=rightbfont size=2 face=ArialFilenbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp;/font/b/tdtd width=5%/tdtd width=50%input type='file' name='path' size=16 value= /td/tr tr td width=50% align=right p align=left /td td width=5% /td td width=50% p align=left input type=submit Value=UPLOAD /td /tr /table /form /center /BODY /HTML Upload.php ?php if(copy($path,$path_name)) { print brbrbrcenterfont face='verdana' size=+2 color=blueYour file $path_name has been uploaded!!!/font/center ; } else { print font face='verdana' size=+2 color=redA problem was encountered during your file upload./fontbr; } ? = -Original Message- From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]] Sent: Monday, July 01, 2002 9:29 PM To: [EMAIL PROTECTED] Subject: [PHP] uploading a file anyone have some code they can send me that will successfully upload a file? I've got all the HTML correct, it's just that my PHP code ain't working. Thanks! Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading a file
On Tuesday 02 July 2002 22:35, Beverly Steiner wrote: Balaji, I tried to implement the code you put in this email and I'm having some problems. I am able to browse and choose a file from my system then click upload. The php script doesn't get the value of $path. The site is running PHP 4.2.1 on Windows NT 5.0. I am using Internet Explorer 6.0.26. Any suggestions on what I need to add? The manual has a perfectly good example on how to upload files. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Hope not, lest ye be disappointed. -- M. Horner */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] uploading a file
anyone have some code they can send me that will successfully upload a file? I've got all the HTML correct, it's just that my PHP code ain't working. Thanks! Phil
RE: [PHP] uploading a file
How do you know it ain't working? Send us your code, maybe we can fix it. -Original Message- From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]] Sent: Monday, July 01, 2002 10:59 AM To: [EMAIL PROTECTED] Subject: [PHP] uploading a file anyone have some code they can send me that will successfully upload a file? I've got all the HTML correct, it's just that my PHP code ain't working. Thanks! Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading a file
Hi Phil, your input file name should be the_file snip global $the_path_news, $the_file_name, $the_file, $the_path; if ($the_file_name) { if (!@move_uploaded_file($the_file, $the_path./.$the_file_name)) { echo something barfed.; exit; } else { echo uploaded.; } } snap Mirza [EMAIL PROTECTED] 01.07.2002 17:59 anyone have some code they can send me that will successfully upload a file? I've got all the HTML correct, it's just that my PHP code ain't working. Thanks! Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] uploading a file
Upload.html === !DOCTYPE html public -//w3c//dtd html 4.0 transitional//en HTML TITLE FileUpload /TITLE head script language=Javascript function check() { document.upload.method = POST; document.upload.enctype='multipart/form-data' document.upload.action=upload.php; document.upload.submit(); return true; } /script /head BODY center form name=upload Onsubmit=return check() enctype='multipart/form-data' brbrbrbr table border=0 width=100% trtd width=30% align=rightbfont size=2 face=ArialFilenbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp;/font/b/tdtd width=5%/tdtd width=50%input type='file' name='path' size=16 value= /td/tr tr td width=50% align=right p align=left /td td width=5% /td td width=50% p align=left input type=submit Value=UPLOAD /td /tr /table /form /center /BODY /HTML Upload.php ?php if(copy($path,$path_name)) { print brbrbrcenterfont face='verdana' size=+2 color=blueYour file $path_name has been uploaded!!!/font/center ; } else { print font face='verdana' size=+2 color=redA problem was encountered during your file upload./fontbr; } ? = -Original Message- From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]] Sent: Monday, July 01, 2002 9:29 PM To: [EMAIL PROTECTED] Subject: [PHP] uploading a file anyone have some code they can send me that will successfully upload a file? I've got all the HTML correct, it's just that my PHP code ain't working. Thanks! Phil **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
[PHP] uploading a file - here is the error message...
Here is the error I'm receiving when attempting to upload a file Warning: Unable to create 'temp/test.txt': Permission denied in /home/.../www/website/upload3.php on line 11 ..could it be that my web host isn't giving me permissions to upload files ?
RE: [PHP] uploading a file - here is the error message...
The web server needs write access to where you're trying to store the files. Check the directory permissions. Check with your ISP to make sure there are solutions other than making the directory world writeable. -Original Message- From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]] Sent: Monday, July 01, 2002 10:13 AM To: [EMAIL PROTECTED] Subject: [PHP] uploading a file - here is the error message... Here is the error I'm receiving when attempting to upload a file Warning: Unable to create 'temp/test.txt': Permission denied in /home/.../www/website/upload3.php on line 11 ..could it be that my web host isn't giving me permissions to upload files ? This message is intended for the sole use of the individual and entity to whom it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message. Thank you very much. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading a file - here is the error message...
That's always possible. Unless you have access to your temp directory you will not be able to update the permissions. At this point I would email your host and ask them about the situation. Good luck. -Kevin - Original Message - From: Phil Schwarzmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 01, 2002 11:13 AM Subject: [PHP] uploading a file - here is the error message... Here is the error I'm receiving when attempting to upload a file Warning: Unable to create 'temp/test.txt': Permission denied in /home/.../www/website/upload3.php on line 11 ..could it be that my web host isn't giving me permissions to upload files ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading a file - here is the error message...
Hi Phil, first thing u should do is to check permission of this directory (CHMOD). the 2nd one, u should replace function copy with move_uploaded_file. than is should work. Mirza [EMAIL PROTECTED] 01.07.2002 19:13 Here is the error I'm receiving when attempting to upload a file Warning: Unable to create 'temp/test.txt': Permission denied in /home/.../www/website/upload3.php on line 11 ..could it be that my web host isn't giving me permissions to upload files ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading a file - here is the error message...
I took your advice first and tried move_uploaded_file and it kept saying It barfed (hehe). Then I switched to copY and got this new error. Thaks for your help!! [EMAIL PROTECTED] 07/01/02 01:29PM Hi Phil, first thing u should do is to check permission of this directory (CHMOD). the 2nd one, u should replace function copy with move_uploaded_file. than is should work. Mirza [EMAIL PROTECTED] 01.07.2002 19:13 Here is the error I'm receiving when attempting to upload a file Warning: Unable to create 'temp/test.txt': Permission denied in /home/.../www/website/upload3.php on line 11 ..could it be that my web host isn't giving me permissions to upload files ?
Re: [PHP] Uploading a file
Jason - Using the recommended HTML, everything works *except* the file does not become part of the data sent back to the server. In fact, the VALUE from the INPUT element is not received (e.g. $filename== $HTTP_POST_VARS[filename];). I am using RH Linux 7.2 with Apache. Is there a parameter in the Apache that needs to be set for file uploads? Many thanks... Todd -- Dr. Todd Cary Ariste Software Petaluma, CA 94952 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Uploading a file
Hi Jason You have set the form's ENCTYPE attribute to 'multipart/form-data' haven't you? FORM ENCTYPE='multipart/form-data' -- Shane On Friday 25 Jan 2002 2:08 pm, Todd Cary wrote: Jason - Using the recommended HTML, everything works *except* the file does not become part of the data sent back to the server. In fact, the VALUE from the INPUT element is not received (e.g. $filename== $HTTP_POST_VARS[filename];). I am using RH Linux 7.2 with Apache. Is there a parameter in the Apache that needs to be set for file uploads? Many thanks... Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Uploading a file
On Friday 25 January 2002 22:08, Todd Cary wrote: Jason - Using the recommended HTML, everything works *except* the file does not become part of the data sent back to the server. In fact, the VALUE from the INPUT element is not received (e.g. $filename== $HTTP_POST_VARS[filename];). I am using RH Linux 7.2 with Apache. Is there a parameter in the Apache that needs to be set for file uploads? If in doubt please check the manual. The uploaded file info are found in $HTTP_POST_FILES not $HTTP_POST_VARS. If you're using php-4.1.0 or above please check manual as $HTTP_POST_FILES will be deprecated in the near future. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Dying is easy. Comedy is difficult. -- Actor Edmond Gween, on his deathbed. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Uploading a file
If you READ, under the first example posted on the URL I referenced, you would see mention of MAX_FILE_SIZE field... which I do not see in your HTML code. Additionally, if you look in the HTML posted in the example on the URL I referenced you would see the actual syntax needed for the MAX_FILE_SIZE field. Daniel J. Lashua On Thu, Jan 24, 2002 at 02:31:03PM -0800, Todd Cary wrote: Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Date: Thu, 24 Jan 2002 14:31:03 -0800 From: Todd Cary [EMAIL PROTECTED] X-Mailer: Mozilla 4.73 [en] (Windows NT 5.0; U) To: daniel [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [PHP] Uploading a file I though I had followed the example in the manual. Are you saying that there is something I missed? Todd -- Todd Cary Ariste Software [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Uploading a file
the MAX_FILE_SIZE field is OPTIONAL, so just because you didn't see it in his code does not mean that's where it was broken at. At 04:42 PM 1/24/2002 -0600, you wrote: If you READ, under the first example posted on the URL I referenced, you would see mention of MAX_FILE_SIZE field... which I do not see in your HTML code. Additionally, if you look in the HTML posted in the example on the URL I referenced you would see the actual syntax needed for the MAX_FILE_SIZE field. Daniel J. Lashua On Thu, Jan 24, 2002 at 02:31:03PM -0800, Todd Cary wrote: Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Date: Thu, 24 Jan 2002 14:31:03 -0800 From: Todd Cary [EMAIL PROTECTED] X-Mailer: Mozilla 4.73 [en] (Windows NT 5.0; U) To: daniel [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [PHP] Uploading a file I though I had followed the example in the manual. Are you saying that there is something I missed? Todd -- Todd Cary Ariste Software [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Uploading a file
I am not well versed in Apache. Is there so parameter that I may not have sett correctly? Something that would cause the problen I am having? Todd -- Todd Cary Ariste Software [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Uploading a file
To keep this arguement from going on indefinately one thing I know that I haven't seen anyone commenting on is the fact that even if MAX_FILE_SIZE is optional, the HIDDEN element is not optional. Somewhere on those PHP pages it says that you need to have one hidden element. MAX_FILE_SIZE is the recommended one. If you don't want to limit yourself, then just set a huge MAX_FILE_SIZE limit. On second thought that might be HTML protocol, but either way you still need that one hidden element. Just put it in and that should get rid of a couple headaches. On a side note, has anyone been able to figure out why I haven't been able to get a file greater than 6 megs to upload? I still have copies of all the messages sent just in case nobody remembers my problem ;) Ron. From: JSheble [EMAIL PROTECTED] To: PHP List [EMAIL PROTECTED] Subject: Re: [PHP] Uploading a file Date: Thu, 24 Jan 2002 16:35:14 -0700 the MAX_FILE_SIZE field is OPTIONAL, so just because you didn't see it in his code does not mean that's where it was broken at. At 04:42 PM 1/24/2002 -0600, you wrote: If you READ, under the first example posted on the URL I referenced, you would see mention of MAX_FILE_SIZE field... which I do not see in your HTML code. Additionally, if you look in the HTML posted in the example on the URL I referenced you would see the actual syntax needed for the MAX_FILE_SIZE field. Daniel J. Lashua On Thu, Jan 24, 2002 at 02:31:03PM -0800, Todd Cary wrote: Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Date: Thu, 24 Jan 2002 14:31:03 -0800 From: Todd Cary [EMAIL PROTECTED] X-Mailer: Mozilla 4.73 [en] (Windows NT 5.0; U) To: daniel [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [PHP] Uploading a file I though I had followed the example in the manual. Are you saying that there is something I missed? Todd -- Todd Cary Ariste Software [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Uploading a file
On Friday 25 January 2002 13:20, Ronald Tezuka wrote: To keep this arguement from going on indefinately one thing I know that I haven't seen anyone commenting on is the fact that even if MAX_FILE_SIZE is optional, the HIDDEN element is not optional. Somewhere on those PHP pages it says that you need to have one hidden element. MAX_FILE_SIZE is the recommended one. If you don't want to limit yourself, then just set a huge MAX_FILE_SIZE limit. On second thought that might be HTML protocol, but either way you still need that one hidden element. Just put it in and that should get rid of a couple headaches. I don't know where you get the HIDDEN element from -- do you have the relevant source? I just use something simple like: form name=upload enctype=multipart/form-data action=repository.php method=post Upload file input type=file name=file input type=submit name=action value=Upload /form which works fine for me! -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Love means nothing to a tennis player. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Uploading a file into a database....ideas please.
Title: Uploading a file into a databaseideas please. Hi all, I have several text files that need to be uploaded each week to a mySQL db. At the moment I'm deleting the tables via telnet then exporting them via ODBC. I have tried uploading in the following ways. 1. Using the copy command, but there are insufficient privileges on the server (security reasons). 2. FTPing the text files in the php script but the version of PHP doesn't allow this. (Updating it not an option). 3. Opening the file remotely (but the file is on my local pc). I'm stuck myself, please help. Thanks in advance. Sam Rose (Also could you reply to my email address as I don't seem to get anymore emails from the list come through)
RE: [PHP] Uploading a file into a database....ideas please.
Title: Uploading a file into a databaseideas please. put a TEXTAREA on a form -cut-paste the textonto the form, submit the form, and have the form put your infointo the database if your server supports PHP, there are many many MySQL admin scripts out there that you could use to add stuff to your DB. -Original Message-From: Sam [mailto:[EMAIL PROTECTED]]Sent: Wednesday, June 20, 2001 5:06 AMTo: 'php'Subject: [PHP] Uploading a file into a databaseideas please. Hi all, I have several text files that need to be uploaded each week to a mySQL db. At the moment I'm deleting the tables via telnet then exporting them via ODBC. I have tried uploading in the following ways. 1. Using the copy command, but there are insufficient privileges on the server (security reasons). 2. FTPing the text files in the php script but the version of PHP doesn't allow this. (Updating it not an option). 3. Opening the file remotely (but the file is on my local pc). I'm stuck myself, please help. Thanks in advance. Sam Rose (Also could you reply to my email address as I don't seem to get anymore emails from the list come through)