Jump to content

Upload problem!


feri_soft

Recommended Posts

[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
Link to comment
https://forums.phpfreaks.com/topic/25073-upload-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.