Jump to content

Uploading files doesn't always work


garydt

Recommended Posts

I have a website that lets users upload jpeg files. Some users upload fine but when others try they get a page full of warnings and lose the site. What would cause this?

 

Also, now when users are logging in they are logging into other users accounts but it was working fine 2 days ago. I haven't changed the script so why is this happening?

Thanks.

Link to comment
Share on other sites

I've worked out the log in problem but still can't why some users are able to upload photos but others can't. Heres the upload script-

 <form name="form1" id="Upload" action="<?php echo $editFormAction; ?>" enctype="multipart/form-data" method="POST"> 
        <p> 
            <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size ?>"> 
        </p> 
        <h3> 
          <input name="file" type="file" id="file" onchange="MM_showHideLayers('Layer1','','hide')" />
          <span class="style1">for your photo</span> </h3>
        <p>
          <label>
          <input name="sent" type="hidden" id="sent" value="1" />
          </label>
        </p>
        <input type="hidden" name="MM_insert" value="form1">
</form>

 

$editFormAction = '';
$max_file_size = 1024*1024*1024; //1MB
if(isset($_POST['sent'])){
unset($submit);
if (isset($_POST['sent'])) $submit = true;
else die('Error: No file got sent');

 

$uploadsDirectory = './uploads/'; 

//Upload image
$uploadFilename = $uploadsDirectory.$fieldname['name'];

// now let's move the file to its final location and allocate the new filename to it 
move_uploaded_file($fieldname['tmp_name'], $uploadFilename);

$user = ($_SESSION['MM_Username']);
$a = rand(0,9999);
resizeimage($fieldname['name']);
rename("thumbnails/".$fieldname['name'], "thumbnails/".$user.$a.$fieldname['name']);
$smallimage = './thumbnails/'.$user.$a.$_FILES['file']['name'];

resizelarger($fieldname['name']);
rename("smallpics/".$fieldname['name'], "smallpics/".$user.$a.$fieldname['name']);
$smallpics = './smallpics/'.$user.$a.$_FILES['file']['name'];

unlink($uploadFilename);

Any ideas?

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.