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_f ile(/uploads/011bc55e70e56ea 8a320e7182166d6 7a.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_f ile(): Unable to move '/tmp/phpOuv94S' to '/uploads/011bc55e70e56ea 8a320e7182166d6 7a.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 1576
I got everything working, thanks anyway.
Atli 5,058
Recognized Expert Expert
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 upload files, like this:
copy ($myfile, $uploadfolder . "/" . $myfile_name);
Everything works fine, it can process large files and everything,
but i need to make sure that people only upload pictures, so i change
|
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 have looked up the error, and added more time to the
script (up to 10 minutes). Didn't help.
|
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 site for a small club I belong to and one of
the features I would like to include is the ability to allow users to upload
image files.
unfortunately the servers web root www folder only allows READ and EXECUTE
permissions, which makes it...
|
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 then max. The folder I'm
trying to upload files to is ./ispit1. I always get the "wrong" echo from
the script when I run debug in my editor and when I run it in my browser
(firefox) I get the following message:
"The requested URL /ispit/__URL__...
|
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 works fine. The doctors want fewer steps to
follow. So, it was asked if I can configure the browser to load/submit
the image 'xray.tif' each time they click "Upload Image" instead of
the doctor/animal technician having to look for for dental x-ray...
| |
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 obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
|
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
my objective is this that when i uplod a file it should be desply on same page with ajax uplod after when i refresh page this should be not remains longer and on clicking other image its replase previous image
plz help
how i can do this the...
|
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
my objective is this that when i uplod a file it should be desply on same page with ajax uplod after when i refresh page this should be not remains longer and on clicking other image its replase previous image
plz help
how i can do this the...
|
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 _uploadedfiles_xxxx) (php must be allowed to move uploaded files to this folder' - uploadedfiles_xxxx.
I typed <?php chmod ('_uploadedfiles_xxxx',640); ?> into notepad and saved it as php in the uploaded_xxxx folder, when I went to test it, the error...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |