Jump to content

Recommended Posts

Alright, I've been trying to figure something out for a while now, and it's gone beyond me. I have a basic upload script for a user on their website that builds a list of links to the uploaded files on their website. It's basic. It puts the file in a directory. Thats all, however they can't get it to work. I can't get it to not work. I've tried on Mac and PC, Opera, Safari, IE, FF and so on and I can't find another instance of this happening. I can't imagine what the user error would be, because it's just pushing a button.

 

PHP 5.2.5, hosted by bluehost, no error message. I have it echoing a message with a link to the file afterwards, for the user, the link doesn't include the file name.

 

has anyone known this to happen or have any ideas as to why one person (who says they've tried it on multiple computers) wouldn't be able to upload a file with a standard script?

 

 

Link to comment
https://forums.phpfreaks.com/topic/89160-bizarre-upload-issue/
Share on other sites

sure thing

 

here is the form:

<html>

<body><BODY bgcolor="efefad">

<font face="Courier New, Courier, mono" size="4"><b>Step 1 of 3: UPLOAD FILE</b><br><br><form action="http://www.website.com/uploadreelfile.php" method="post"

enctype="multipart/form-data">

<label for="file">Movie File:</label>

<input type="file" name="file" id="file" />

<br /></BR></BR>

<input type="submit" name="submit" value="Submit" />

</font>

</form>

 

here is the php

<?php

  if ($_FILES["file"]["error"] > 0)

    {

    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";

    }

  else

    {

    echo "Upload: " . $_FILES["file"]["name"] . "<br />";

    echo "Type: " . $_FILES["file"]["type"] . "<br />";

    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";

    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    if (file_exists("files/" . $_FILES["file"]["name"]))

      {

      echo $_FILES["file"]["name"] . " already exists. ";

      }

    else

      {

      move_uploaded_file($_FILES["file"]["tmp_name"],

      "reelfiles/" . $_FILES["file"]["name"]);

echo "<br><br>";

      echo "<b><font size=5>File Address:</font></b> ";

echo "<br><br>

<textarea cols='100' readonly='0'>";

echo "http://www.website.com/reelfiles/" . $_FILES["file"]["name"];

echo "</textarea>";

echo "<br><br>";

echo "<b>Copy This address to use link</b>";

      }

    }

 

As I mentioned, I can't get it to not work. It's hard to troubleshoot a problem one can't recreate, so as far as I can tell it works. The client can't get it work though. THey are the only person that uses it, so thats a problem. When they get to the second page it doesn't give an error message, it just has blank info, no file size, the echoed file path doesn't have a file name, and when I look for the file on the server nothign has been uploaded. When I use it, this all works fine.

 

ideas?

Link to comment
https://forums.phpfreaks.com/topic/89160-bizarre-upload-issue/#findComment-457002
Share on other sites

try modifying your move_uploaded_file to include the full file name

move_uploaded_file($_FILES["file"]["tmp_name"],
      dirname(__FILE__)."reelfiles/" . $_FILES["file"]["name"]);

 

i had a similar problem and that fixed it

 

Scott.

 

Link to comment
https://forums.phpfreaks.com/topic/89160-bizarre-upload-issue/#findComment-457025
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.