...

View Full Version : Please check there are no problems with this script



gsnedders
01-25-2004, 03:56 PM
<?

// 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>

fimi
01-25-2004, 04:10 PM
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.

gsnedders
01-25-2004, 04:34 PM
There is a problem, either in the script or it's the server, fimi

Nightfire
01-25-2004, 04:37 PM
And what is the problem? Do you get errors? Nothing show up? Nothing upload?

gsnedders
01-25-2004, 04:54 PM
Log:
Couldn't copy image 1 to server


But the Server is set to allow writing for anyone:confused:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum