Unstoppable Domains โ€” Get your daily AI drops report

Man.. I need help with this image upload script

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch
Impact
34
Main Page:
<html>
<head>
<title>Upload Image</title>
</head>
<body>
<form method=POST action=do_upload.php enctype=multipart/form-data>
<p>Files to upload:<br>
<input type=file name=img1 size=30><br>
<input type="submit" name="submit" value="Upload">
</form>
</body>
</html>
Second Page
<?
//user defined variables
$abpath = "/home/majinbuu/public_html/upload/images"; //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

//all image types to upload
$cert1 = "image/pjpeg"; //Jpeg type 1
$cert2 = "image/jpeg"; //Jpeg type 2
$cert3 = "image/gif"; //Gif type

$log = "";
$random1 = rand(1, 99999999);
$random2 = rand(1, 99999999);
$random3 = rand(1, 99999999);
$random4 = rand(1, 99999999);
$random5 = rand(1, 99999999);


//begin upload 1

//checks if file exists
if ($img1_name == "") {
$log .= "No file selected for upload 1<br>";
}
if ($img1_name != "") {
//checks if file exists
if (file_exists("$abpath/$img1_name")) {
$log .= "File 1 already existed<br>";
} else {

//checks if files to big
if ($sizelim == "yes") {
if ($img1_size > $size) {
$log .= "File 1 was too big<br>";
}
}

//Checks if file is an image
if (($img1_type == $cert1) or ($img1_type == $cert2) or ($img1_type == $cert3)) {
if (($img1_type == $cert1) or ($img1_type == $cert2)) {
$img1_name = $random1 . ".jpeg";
}
if ($img1_type == $cert3) {
$img1_name = $random1 . ".gif";
}
@copy($img1, "$abpath/$img1_name") or $log .= "Couldn't copy image 1 to server<br>";
if (file_exists("$abpath/$img1_name")) {
$log .= "File 1 was uploaded<br>";

when an image uploads,
all it says is
Log:
File 1 was uploaded
How can I make it say the url to the image?

Please help
Dylan
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
This should work (replace the last line with this)

Code:
$log .= "File 1 was uploaded<br>Image Address: http://www.mysite.com/upload/images/".$img1_name;

eg. if the file name is 123.jpg, it will say:

Code:
File 1 was uploaded.
Image Address: http://www.mysite.com/upload/images/123.jpg
 
0
•••
Thanks, I will try it
 
0
•••
let us know if it works
 
0
•••
Appraise.net
Escrow.com
Spaceship
Domain Recover
CryptoExchange.com
Catchy
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back