I am working on a similar thing. Someone sent me this code and I have been trying to make it work and when the file is uploaded it says it is password protected. I can go open the file through FTP. I am trying to use the picture in a webpage. I can put a picture directly into the directory where I am putting the files and link to them so it has to do with how I am uploading the files I am sure. I think it may have something to do with permissions and I can't seem to change them. The files get there. The DB gets updated. Browser can't access the files.
<?php
if ($FileToUpload_type == 'image/gif') {
$type = '.gif';
}
if ($FileToUpload_type == 'image/pjpeg') {
$type = '.jpg';
}
if ($FileToUpload_type == 'image/x-png') {
$type = '.jpg';
}
$newfile = substr($FileToUpload, -9);
if($FileToUpload_name = '') {
print("No file was selected!");
}
elseif($FileToUpload_size > $MaxFileSize) {
print("The file to upload is too big");
}
else {
$global_db = mysql_connect('mysql', 'surething', '1234');
mysql_select_db('Steve', $global_db) or die("Connection error");
$query = "INSERT INTO ulimages (Filename,name,car,engine,times,mods,thanks,cost,asking,pic) VALUES ('$newfile$type','$name','$car','$engine','$times','$mods','$thanks','$cost','$asking','$pic')";
$result = mysql_query($query) or die("ERROR");
move_uploaded_file($FileToUpload, "//steve/ulimages/$newfile$type");
}
?>