maybe a simple thing but i haven't found anything about this issue.
I have a script that upload file pushing buttons, but i want substitute buttons with links.
could you help me to solve this problem?
Thank you,
LetoDuke
this is code with button:
Code: Select all
<?php
$site_name = $_SERVER['HTTP_HOST'];
$url_dir = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
$url_this = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
$upload_dir = "inputfiles/"; // Check if this one exist
$upload_url = "http://localhost/inputfiles/";
$message ="";
if ($_FILES['userfile']) {
$message = do_upload($upload_dir, $upload_url);
}
else {
$message = "Invalid File Specified. Ignore if you havent clicked upload yet";
}
print $message;
// Function that perform the upload
function do_upload($upload_dir, $upload_url)
{
$temp_name = $_FILES['userfile']['tmp_name'];
$file_name = "temp.txt";
$file_type = $_FILES['userfile']['type'];
$file_size = $_FILES['userfile']['size'];
$result = $_FILES['userfile']['error'];
$file_url = $upload_url.$file_name;
$file_path = $upload_dir.$file_name;
if ( $file_name =="") //File Name Check
{ $message = "Invalid File Name Specified";
return $message;
}
else if ( $file_size > 15000000) //File Size Check
{ $message = "The file size is over 15.000K.";
return $message;
}
$result = move_uploaded_file($temp_name, $file_path);
$message= ($result)?"" :"File not uploaded... some problem occurs.";
return $message;
}
?>Code: Select all
<title>Raw data upload</title>
<form name="upload" id="upload" ENCTYPE="multipart/form-data" method="post">
<input type="file" id="userfile" name="userfile"><input type="submit" name="upload" value="Upload">
</form>