...

View Full Version : image upload form



vegasbp
11-06-2006, 04:06 AM
OK so I am using this code to sorta make a small image host for me and my friends but its acting up........to start, here is my code

<?php

if($_FILES['fild']['name']){
$file_path = $_FILES['fild']['tmp_name'];
$file_name = $_FILES['fild']['name'];
$file_size = $_FILES['fild']['size'];
$file_type = $_FILES['fild']['type'];
$file_error = $_FILES['fild']['error'];

if(is_uploaded_file($file_path)){
copy($file_path, $file_name) or die('There was an error while uploading your file. Please try again.');
echo('Your file has been uploaded.<br>Thank you!');
echo ("<br>The URL is: rxrowley.6te.net/1/".$_FILES['fild']['name']);
}
}else{
?>

<form method="post" enctype="multipart/form-data">
<input TYPE="file" name="fild">
<input name="submit" type="submit" value="Upload" />
</form>
<?php
}
?>


So, The image will upload just fine, but when I try to put in the URL, it does not work, the only way I can get the image to display is by making a link from a page.....hmmmm.......any takers?

vegasbp
11-06-2006, 04:43 AM
I guess what im trying to do is in the echo that says the URL is.... to make it a link to the file, I just cant figure out how to write the code for a link in php

littlejones
11-06-2006, 08:27 AM
You don't need to put the echo statement in brackets. Also are you absolutely certain that the folder called '1' that is where the images are stored has read permissions set?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum