Jump to content

Upload using move_uploaded_file


waverider303

Recommended Posts

When i use the move_uploaded_file to upload images I think it is uploading using ASCII mode to transfer. Because when I goto view the image that I uploaded I get an error. Im using shared hosting from Doteasy.com do I need to change information in the php.ini file to make it upload in binary?

Link to comment
Share on other sites

$small_file_name = $_FILES['small']['name'];
$small_tmp_name = $_FILES['small']['tmp_name'];
$destination = '../webisode_images';

if(!empty($small_file_name)) {
		if(move_uploaded_file($small_tmp_name,"$destination/$small_file_name")) {
			$sql .= ", small_file_name='$small_file_name' ";
		}
	}

Link to comment
Share on other sites

<?php
					$sql = "SELECT * FROM webisodes WHERE season=1";
					$result =mysql_query($sql);
					while ($row=mysql_fetch_assoc($result)){
						$title=$row['title'];
						$description=$row['description'];
						$video_large=$row['video_large'];
						$episode=$row['episode'];
						$small_file_name=$row['small_file_name'];
						$season=$row['season'];
					}
				?>
                    <a href="webisodes.php?season=<?=$season?>"><img src="<?=$small_file_name" title="<?=$title?>" alt="<?=$title?>" height="150px" width="150px" /></a>

 

What the problem is... is that if you goto the url that the file was uploaded i get an 404 error from my hosting company saying that the file is not there. When I FTP into my account I see the files there.

 

Link to comment
Share on other sites

A 404 error page?

 

 

Pretty sure your path is wrong then.

 

 

Oh hrmmm....  Wonder if it is this:

 

 

"<?=$small_file_name"

 

 

You missed the closing ?>.

 

 

 

It's bad practice to use short tags by the way since they're sometimes disabled on some servers.

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.