-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathartistupload.php
32 lines (25 loc) · 951 Bytes
/
artistupload.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
$target_dir = "images/";
$files = scandir(getcwd()."/images");
$imageIndex = count($files) - 1;
$infilename = basename( $_FILES["fileToUpload"]["name"]);
$extension = substr($infilename,-4);
//$target_file = $target_dir . "image" . $imageIndex . $extension;
$target_file = $infilename;
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if file already exists
if (file_exists($target_file)) {
$imageIndex += 1;
// $target_file = $target_dir . "image" . $imageIndex . $extension;
}
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], "images/img".time().$extension)) {
echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
}
else{
echo "upload failed for some reason, possibly image size. Try screen shotting and uploading that(smaller) image.";
}
?>
<p style = "font-size:5em">
<a href = "artist.html">ARTIST</a>
</p>