Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts

    Problem with this script

    Code:
    <?
    
    // Original script developed by the Zach White Network.
    // Modifications for flexible multi-uploads developed by
    // Greg Johnson
    // gjohnson@7south.com
    // 7 South Communications, Inc.
    // www.7south.com
    // Mod Date: 11-07-02
    // This Modification of the Modified version
    // is by HSTEU
    // link92@hsteu.57host.biz
    
    
    //user defined variables
    $abpath = "http://hsteu.57host.biz/userpictures"; //Absolute path to where images are uploaded. No trailing slash
    $sizelim = "no"; //Do you want size limit, yes or no
    $size = "2500000"; //What do you want size limited to be if there is one
    $number_of_uploads = 1;  //Number of uploads to occur
    
    if ($_REQUEST['submitted']){ // Begin processing portion of script
    
    //all image types to upload
    $cert1 = "image/pjpeg"; //Jpeg type 1
    $cert2 = "image/jpeg"; //Jpeg type 2
    $log = "";
    
    for ($i=0; $i<$number_of_uploads; $i++) {
    
    	//checks if file exists
    	if ($img_name[$i] == "") {
    		$log .= "No file selected for upload $i<br>";
    	}
    
    	if ($img_name[$i] != "") {
    		//checks if file exists
    		if (file_exists("$abpath/$img_name[$i]")) {
    			$log .= "File $i already existed, please change name<br>";
    		} else {
    
    			//checks if files to big
    			if (($sizelim == "yes") && ($img_size[$i] > $size)) {
    				$log .= "File $i was too big<br>";
    			} else {
    
    
    				//Checks if file is an image
    				if (($img_type[$i] == $cert1) or ($img_type[$i] == $cert2)) {
    					@copy($img[$i], "$abpath/$img_name[$i]") or $log .= "Couldn't copy image 1 to server<br>";
    					if (file_exists("$abpath/$img_name[$i]")) {
    						$log .= "File $i was uploaded<br>";
    					}
    					} else {
    						$log .= "File $i is not an .jpg or .jpeg<br>";
    					}
    				}
    			}
    		}
    
    
    	}
    
    ?>
    
    <html>
    <head>
    <title>Image Report</title>
    </head>
    <body>
    <p>Log:<br>
    <?
    
    echo "$log";
    
    ?>
    </p>
    <body>
    </html>
    <? 
    exit;
    } // End processing portion of script
    ?>
    
    <html>
    <head>
    <title>Upload Image</title>
    </head>
    <body>
    <form method=POST action=uploadmulti.php enctype=multipart/form-data>
    <p>.jpg or .jpeg to upload:<br><br>
    <? 
    
    for ($j=0; $j<$number_of_uploads; $j++) {
    ?>
    <input type=file name=img[] size=30><br>
    <?
    }
    ?>
    <BR>
    <input type="hidden" name="submitted" value="true">
    <input type="submit" name="submit" value="Upload"> 
    </form>
    </body>
    </html>
    Last edited by gsnedders; 01-25-2004 at 09:04 PM.

  • #2
    New Coder
    Join Date
    Dec 2003
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i thought this is a helping forum for those who need it.

    what you are doing is just copy&past the script and ask us to see if there is a problem?!
    how about you try it first and then ill see if i can help if you have problems.

  • #3
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    There is a problem, either in the script or it's the server, fimi

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    And what is the problem? Do you get errors? Nothing show up? Nothing upload?

  • #5
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    Log:
    Couldn't copy image 1 to server
    But the Server is set to allow writing for anyone


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •