Hello,
I keep getting the following erorrs when trying to use a PHP/MYSQL upload script. Can anyone tell me what's causing this error? I'm not a programmer, just an MFA student working on his thesis and needs to collect images from several thousand people.
So far I have CMOD 777 the directory that uploads are going into and tried different directories but nothing has worked.
Thanks in advance!
Warning: move_uploaded_file(/uploads/011bc55e70e56ea8a320e7182166d67a.JPG): failed to open stream: No such file or directory in /home/content/g/r/o/grozanc/html/pavementmemoirs/uploads/upload3.php on line 42
Warning: move_uploaded_file(): Unable to move '/tmp/phpOuv94S' to '/uploads/011bc55e70e56ea8a320e7182166d67a.JPG' in /home/content/g/r/o/grozanc/html/pavementmemoirs/uploads/upload3.php on line 42
Error uploading file
Here is the code to the script I'm trying to run: -
<html>
-
<head>
-
<title>Upload File To MySQL Database</title>
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-
<style type="text/css">
-
<!--
-
.box {
-
font-family: Arial, Helvetica, sans-serif;
-
font-size: 12px;
-
border: 1px solid #000000;
-
}
-
-->
-
</style>
-
</head>
-
-
<body>
-
<?
-
// you can change this to any directory you want
-
// as long as php can write to it
-
$uploadDir = '/uploads/';
-
-
-
if(isset($_POST['upload']))
-
{
-
$fileName = $_FILES['userfile']['name'];
-
$tmpName = $_FILES['userfile']['tmp_name'];
-
$fileSize = $_FILES['userfile']['size'];
-
$fileType = $_FILES['userfile']['type'];
-
-
// get the file extension first
-
$ext = substr(strrchr($fileName, "."), 1);
-
-
// generate the random file name
-
$randName = md5(rand() * time());
-
-
// and now we have the unique file name for the upload file
-
$filePath = $uploadDir . $randName . '.' . $ext;
-
-
// move the files to the specified directory
-
// if the upload directory is not writable or
-
// something else went wrong $result will be false
-
$result = move_uploaded_file($tmpName, $filePath);
-
if (!$result) {
-
echo "Error uploading file";
-
exit;
-
}
-
-
include 'library/config.php';
-
include 'library/opendb.php';
-
-
if(!get_magic_quotes_gpc())
-
{
-
$fileName = addslashes($fileName);
-
$filePath = addslashes($filePath);
-
}
-
-
$query = "INSERT INTO upload2 (name, size, type, path ) ".
-
"VALUES ('$fileName', '$fileSize', '$fileType', '$filePath')";
-
-
mysql_query($query) or die('Error, query failed : ' . mysql_error());
-
-
include 'library/closedb.php';
-
-
echo "<br>File uploaded<br>";
-
}
-
?>
-
<form action="" method="post" enctype="multipart/form-data" name="uploadform">
-
<table width="350" border="0" cellpadding="1" cellspacing="1" class="box">
-
<tr>
-
<td width="246"><input type="hidden" name="MAX_FILE_SIZE" value="200000000"><input name="userfile" type="file" class="box" id="userfile">
-
</td>
-
<td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td>
-
</tr>
-
</table>
-
</form>
-
</body>
-
</html>
-
2 1543
I got everything working, thanks anyway.
Atli 5,058
Expert 4TB
I got everything working, thanks anyway.
Hi, grozanc, and welcome to TSDN.
I'm glad to hear you have solved your problem.
Would you be willing to share your solution with us?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Tihon |
last post by:
Hello!
I again need your help, just can't understand whats going on.
Got this upload pictures form and it's having problem handling large
files (~1.5 - 2 MB).
Everything works fine if i just...
|
by: Martin |
last post by:
I have an ASP form that uploads files to our server.
When I upload small files, it works great.
But larger files like (2.5mb), I get:
Active Server Pages error 'ASP 0113'
Script timed out
I...
|
by: Wayne Smith |
last post by:
I've come up against a major headache that I can't seem to find a solution
for but I'm sure there must be a workaround and I would really be grateful
of any help.
I'm currently building a web...
|
by: ljuljacka |
last post by:
I'm just trying to run a fileupload script from the manual, just to see how
it works, and it won't. I've checked if file upload is enabled and it is.
Also, the file I'm trying to upload is smaller...
|
by: Steve Poe |
last post by:
I work for an animal hospital trying to use PHP to store an animal's
dental x-rays to a file server.
I can browse for the xray on the local desktop computer then click
"Upload Image". This...
|
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Uploading files from a local computer to a remote web server has many useful purposes, the most...
|
by: kksandeep |
last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help
the script i found is some helpful but not too that i need
...
|
by: kksandeep |
last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help
the script i found is some helpful but not too that i need
...
|
by: camphor |
last post by:
hi,
I have found an upload script in hotscripts and have implemented it into the website, I followed the installation steps to 'give write permissions to php on the upload folder (which is...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |