feri_soft Posted October 25, 2006 Share Posted October 25, 2006 [code]<?php$file1 = $_REQUEST['file1'];$file2 = $_REQUEST['file2'];$file3 = $_REQUEST['file3'];$file4 = $_REQUEST['file4'];include 'thumbnail_generator.php';$uploadDir = '/upload/';if(!empty($file1)){ $fileName = $_FILES['file1']['name']; $tmpName = $_FILES['file1']['tmp_name']; $fileSize = $_FILES['file1']['size']; $fileType = $_FILES['file1']['type']; // get the file extension first $ext = substr(strrchr($fileName, "."), 1); // generate the random file name include 'db.php';$query = "SELECT * FROM `listings` ORDER by listid DESC LIMIT 1";$result = mysql_query($query);while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $randName = $row['listid'];} // and now we have the unique file name for the upload file $filePath = $uploadDir . $randName . '-1' . '.' . $ext; // move the files to the specified directory // if the upload directory is not writable or // something else went wrong $result will be false $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error uploading file"; exit; } $filePath2 = $uploadDir . $randName . '-1' . '-small' . '.' . $ext; createthumb($filePath,$filePath2,100,100); $fileName = trashinput($fileName); $filePath = trashinput($filePath); $filePath2 = trashinput($filePath2); $query = "INSERT INTO images (imgid, listid, imgurl, thumburl, date) ". "VALUES ('$randName', '$filePath', '$filePath2', now())"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); echo "<br>File uploaded<br>"; } ?>[/code]It just dont want to upload.Forget the resizes they work fine when are seperated but the upload isnt working help needed very fast! PLEASE Quote Link to comment Share on other sites More sharing options...
mschrank99 Posted October 25, 2006 Share Posted October 25, 2006 You've gotta cut and paste the error message it's given you so we can compare it to the code, otherwise it doesn't help us.-Matthew Quote Link to comment Share on other sites More sharing options...
feri_soft Posted October 26, 2006 Author Share Posted October 26, 2006 I found the problem but cant find a solution.When the if clause is removed everything is fine.Upload,database,thumbs.But the if causes problems and the script just gives a blanc screen.Can someone find a solution for replacing the if?? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.