Re: [PHP] php upload script problems

2004-09-25 Thread Marek Kilimajer
AMC wrote:
Hi,
I have the following php page. The page just opens up blank and I assume I
made an error I cannot see. I'm new to php and any help would  be greatly
appreciated:
What is your register_globals and display_errors setting?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php upload script problems

2004-09-25 Thread Pablo M. Rivas
Hello:
 When you want to know where is your error, set: error_reporting(E_ALL);
http://www.php.net/manual/en/function.error-reporting.php

the error is here:

case upload:

echohtmlheadtitleFile Upload/title/headbodyform method=POST
action=$PHP_SELF?action=doupload enctype=multipart/form-data
ID=Form1pFile to upload:brinput type=file name=file size=30
ID=File1;

you might change :
   ID=Form1
and ID=File1

for :

  ID=\Form1\
and ID=\File1\

echohtmlheadtitleFile Upload/title/headbodyform method=POST
action=$PHP_SELF?action=doupload enctype=multipart/form-data
ID=\Form1\pFile to upload:brinput type=file name=file size=30
ID=\File1\;

Good Luck!

On Fri, 24 Sep 2004 16:01:48 -0700, AMC [EMAIL PROTECTED] wrote:
 Hi,
 
 I have the following php page. The page just opens up blank and I assume I
 made an error I cannot see. I'm new to php and any help would  be greatly
 appreciated:
 
 ?php
 
 $extlimit = yes; //Do you want to limit the extensions of files uploaded
 
 $limitedext = array(.pdf); //Extensions you want files uploaded limited
 to.
 
 $sizelimit = no; //Do you want a size limit, yes or no?
 
 $sizebytes = 20; //size limit in bytes
 
 $dl = http://www.corrige2.bluehill.com/pdfs;; //url where files are
 uploaded
 
 $absolute_path = http://www.corrige2.bluehill.com/pdfs;; //Absolute path to
 where files are uploaded
 
 $websiteurl = http://www.corrige2.bluehill.com;; //Url to you website
 
 $websitename = Corrigent;
 
 switch($action) {
 
 default:
 
 echo htmlheadtitleUpload Or Download/title/headbodya
 href=$PHP_SELF?action=uploadUpload File/a a
 href=$PHP_SELF?action=downloadDownload File/a;
 
 echo a href=$websiteurlReturn to $websitename/abrbrPowered by PHP
 Uploader Downloader/a/body/html;
 
 break;
 
 case download:
 
 echo htmlheadtitleFile Download/title/headbodya
 href=$PHP_SELF?action=uploadUpload File/a a href=$websiteurlReturn to
 $websitename/a;
 
 $list = table width=700 border=1 bordercolor=#00
 style=\border-collapse: collapse\;
 
 $list .= trtd width=700centerbClick To
 Download/b/center/td/tr;
 
 $dir = opendir($absolute_path);
 
 while($file = readdir($dir)) {
 
 if (($file != ..) and ($file != .)) {
 
 $list .= trtd width=700a
 href='$dl/$file'$file/a/center/td/tr;
 
 }
 
 }
 
 $list .= /table;
 
 echo $list;
 
 echobrbrPowered by PHP Uploader Downloader/a/body/html;
 
 break;
 
 case upload:
 
 echohtmlheadtitleFile Upload/title/headbodyform method=POST
 action=$PHP_SELF?action=doupload enctype=multipart/form-data
 ID=Form1pFile to upload:brinput type=file name=file size=30
 ID=File1;
 
 echopbutton name=submit type=submit
 ID=Button1Upload/button/formbrbrPowered by PHP Uploader
 Downloader/a/body/html;
 
 break;
 
 //File Upload
 
 case doupload:
 
 $dir = dir;
 
 if ($file != ) {
 
 if (file_exists($absolute_path/$file_name)) {
 
 die(File already exists);
 
 }
 
 $ext = strrchr($file_name,'.');
 
 if (($extlimit == yes)  (!in_array($ext,$limitedext))) {
 
 die(The file you are uploading doesn't have the correct extension.);
 
 }
 
 @copy($file, $absolute_path/$file_name) or die(The file you are trying to
 upload couldn't be copied to the server);
 
 } else {
 
 die(Must select file to upload);
 
 }
 
 echo htmlheadtitleFile Uploaded/title/headbody;
 
 echo $file_name. was uploaded;
 
 echo bra href=$PHP_SELF?action=uploadUpload Another File/aa
 href=$PHP_SELF?action=download Download File/aa href=$websiteurl Return
 to $websitename/abrbrPowered by a href=http://www.zachwhite.com/PHP
 Uploader Downloader/a/body/html;
 
 break;
 
 }
 
 ?
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 



-- 
Pablo M. Rivas. http://pmrivas.ipupdater.com http://www.r3soft.com.ar
---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php upload script problems

2004-09-25 Thread Jim Grill
 Hi,

 I have the following php page. The page just opens up blank and I assume I
 made an error I cannot see. I'm new to php and any help would  be greatly
 appreciated:

 ?php

 $extlimit = yes; //Do you want to limit the extensions of files uploaded

 $limitedext = array(.pdf); //Extensions you want files uploaded limited
 to.

 $sizelimit = no; //Do you want a size limit, yes or no?

 $sizebytes = 20; //size limit in bytes

 $dl = http://www.corrige2.bluehill.com/pdfs;; //url where files are
 uploaded

 $absolute_path = http://www.corrige2.bluehill.com/pdfs;; //Absolute path
to
 where files are uploaded

Aside from what others have pointed out, your absolute path is not a file
path at all. This will cause some problems later on in the script when you
try to upload an image file to a URL instead of a file path.

Jim Grill

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php