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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.