473,509 Members | 2,950 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problems uploading files through a form

107 New Member
i have a form which allows files to be uploaded. i have no problem with the upload script as it works perfectly within my local web server. As i host it in my hosting server the upload do not work. i have checked for the php settings in both my local server as well as my hosting server. I have set the local settings as in the hosting server with a few things not identical. One is the upload_tmp_dir which is set in my server but not in the hosting server. So, after some googling i could come across the problem of upload_tmp_dir which could be a reason in my case. So, how should i confirm this or solve this problem?

if you would like to view my code, its here:
Expand|Select|Wrap|Line Numbers
  1. function($fname, $tmpfile){
  2. $ext = str_replace(".","",strtolower(substr($fname, -4, 4))); 
  3. $new = strtotime("now");
  4. $newname = $new.".".$ext;
  5. if(move_uploaded_file($tmpfile, "files/{$newname}")) {
  6.    ...... then here goes the code to insert the form 
  7. values along with the file path
  8. }
  9. }
  10.  
Sep 21 '09 #1
4 1957
Markus
6,050 Recognized Expert Expert
Try turning on error reporting to aid with debugging.

Do you have access to the server (more precisely, PHP's configuration)?
Sep 21 '09 #2
TheServant
1,168 Recognized Expert Top Contributor
So echo ini_get('upload_tmp_dir'); returns NULL?

I think that it's set in your php.ini file. Do you have access to that?
Add this to your php.ini (if it's not already there) to try a test:
file_uploads = On
upload_tmp_dir = {your directory}

I am sorry if you have already tried this, but let's just make sure the thing is plugged in!
Sep 21 '09 #3
raamay
107 New Member
since you are online, i submit the error that i get when i try to upload a file. i have put on error reporting. The following is the error:
Expand|Select|Wrap|Line Numbers
  1. Warning: move_uploaded_file(files/1253849403.doc) [function.move-uploaded-file]: failed to open stream: Permission denied 
  2. Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/var/tmp/phpHBrCgj' to 'files/1253849403.doc' 
May be you have some idea about this. Its surely to do with the upload_tmp_dir.
Sep 25 '09 #4
zorgi
431 Recognized Expert Contributor
@raamay
Try changing permissions for that directory/file
Sep 25 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
3980
by: lion | last post by:
I get these errors when uploading images via a web page: (the page still uploads the images but reports these errors?) Warning: fopen(D:\php\uploadtemp\php1FC7.tmp) : failed to create stream: No...
4
2762
by: dickiedyce | last post by:
Hi there. I've spent the weekend getting ever more frustrated, trying to get an upload file function working on a website. The site is hosted by a company called oneandone. They're using PHP...
6
2813
by: Chamomile | last post by:
can anyone point me to some straightforward information on file uploading without using an html form? That is, direcly from within a php script. if I know the local path etc. to a particular...
12
1305
by: Logan | last post by:
Hi, I am not a very experienced asp.net developer, but have a fair idea on how it works & better idea on vb.net. My requirement is to place an asp.net page on a website - which currently has...
2
1426
by: tshad | last post by:
I have a page that I am using for multiple uses that includes reposting of the page as well as going to another page where the "form" tag would be something like: <form id="something"...
5
2709
by: Chris | last post by:
I have a meetings section I'm developing on our intranet. Using PHP/MySQL. Meeting info and Meeting docs reside on 2 related tables in the db. Users may want to upload anywhere from 1 to 10 or...
2
1468
by: Glenn Coyle | last post by:
Hi I am having issues with trying to upload files to a directory on my server. the first script is the form the second is the upload file, it just doesnt identify the file path where it is...
6
4082
by: ajaykataram | last post by:
Hi all i am getting error in the following code to upload files csv and txt files i have to insert the following values only into database if firstname,lastname and email id is null it should not...
221
366982
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
0
2699
by: LoriFranklin | last post by:
I'm a bit of a newbie here. I've learned a lot from reading the posts you all have here. I need some help uploading files using an asp form. I am using some code that I found from Jacob at...
0
7234
marktang
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,...
0
7344
Oralloy
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,...
0
7412
jinu1996
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...
1
7069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5060
isladogs
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...
0
4730
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...
0
3216
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
441
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.