473,385 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

problem with upload..

11
i got html code
file name
[HTML]html
<html>

<head>
<title></title>
</head>

<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>
</body>

</html>
[/HTML]
and my php file name upload.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $target = "http://example.com/up/";
  4. $target = $target . basename( $_FILES['uploaded']['name']) ;
  5. $ok=1;
  6.  
  7. //This is our size condition
  8. if ($uploaded_size > 350000)
  9. {
  10. echo "Your file is too large.<br>";
  11. $ok=0;
  12. }
  13.  
  14. //This is our limit file type condition
  15. if ($uploaded_type =="text/php")
  16. {
  17. echo "No PHP files<br>";
  18. $ok=0;
  19. }
  20.  
  21. //Here we check that $ok was not set to 0 by an error
  22. if ($ok==0)
  23. {
  24. Echo "Sorry your file was not uploaded";
  25. }
  26.  
  27. //If everything is ok we try to upload it
  28. else
  29. {
  30. if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
  31. {
  32. echo "The file ".
  33. basename( $_FILES['uploadedfile']['name']). " has been uploaded";
  34. }
  35. else
  36. {
  37. echo "Sorry, there was a problem uploading your file.";
  38. }
  39. }
  40. ?>
  41.  
  42.  
<link removed> is place where i want to upload file
<link removed> is place where my script is located
and when run the script i am reciving thiss

Expand|Select|Wrap|Line Numbers
  1. Warning: move_uploaded_file(http://example.com/up/l1.php) [function.move-uploaded-file]: failed to open stream: HTTP wrapper does not support writeable connections. in /is/htdocs/wp1055726_DP59DMU8M7/www/upload.php on line 37
  2.  
  3. Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpAKTFWT' to 'http://example.com/up/l1.php' in /is/htdocs/wp1055726_DP59DMU8M7/www/upload.php on line 37
  4. Sorry, there was a problem uploading your file.?> 
  5.  
please help
Oct 19 '07 #1
3 3989
Atli
5,058 Expert 4TB
Hi.

I have removed the links from your post. Please refrain from using real URL's in your posts.

As to your problem.
Try using a relative path to the your $target file instead of an absolute path.
Instead of using "http://example.com/up/" use "up/".
Oct 20 '07 #2
kujtim
11
thenks for your advise about url's .

i have tryed to to use the relativ url but steal not working . i am reciving the same warning as before

Expand|Select|Wrap|Line Numbers
  1.  Warning: move_uploaded_file(New Text Document.txt) [function.move-uploaded-file]: failed to open stream: Permission denied in /is/htdocs/wp1055726_DP59DMU8M7/www/upload.php on line 37
  2.  
  3. Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpvbACgU' to 'New Text Document.txt' in /is/htdocs/wp1055726_DP59DMU8M7/www/upload.php on line 37
  4. Sorry, there was a problem uploading your file.?>
  5.  
thenks for helping
Oct 20 '07 #3
Atli
5,058 Expert 4TB
Hi. Sorry for the late reply.

Take a closer look at the second batch of errors. That is not the same error as before :)

This error would suggest that you (the user that is running your http server) does not have permission to write in the directory you are trying to save the files in.

The PHP code works fine (most likely). The problem is that you server won't allow it to write into that particular directory.

The best way to make sure your PHP code can write to a directory is that have a PHP code create it. Check out the mkdir() function.
Oct 23 '07 #4

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

Similar topics

0
by: Paul Hamlington | last post by:
Hello, I've been programming in ASP for a little while now and quite an advanced user, but I have come across an unusual problem in which I need assistance. I have built my own image upload,...
3
by: John Rebbeck | last post by:
(sorry about cross posting but I really need help with this and it fits in both newsgroups) I'm creating a little image manager and I'm using Persits ASPUpload. I have an UploadButton and...
4
by: NohaKhalifa | last post by:
Dear All; I'm developing a web site and i need to make adminisration for this site it's a site for Real Estates . But I don't need the administration to be online .. I want them to fill data...
3
by: Tim::.. | last post by:
Can someone please tell my why I get the following problem when I type the following piece of code! How do I get around this??? The idea is that when a user clicks a button on a form it causes...
2
by: prakharv | last post by:
Hi All, Below is the code which I am using to upload a jpeg file to the server. But the problem I am facing is that it is not copying the entire contents of the image file to the webserver and it...
0
by: RichBurdes | last post by:
Hi All, I've just started using ASPupload and can successfully submit files to a directory on the web server and form data to a database - i can then retrieve the form data and links to the files...
4
by: Muddasir | last post by:
Hi.. i am having a strange problem.......the problem is i am trying to upload a file and to store it in db....when the file got stored in db...it got converted into black and white image and...
12
by: K. | last post by:
Hello! I have a problem with SWFupload class1. I have the page with uses SWFUpload class. Everything worked fine until (I suppose my admin) implemented some changes into the server. Now uploading...
2
by: swethak | last post by:
Hi, i wrote a code to upload a image.In my local it works fine. When i place this code in website through FTP. In that it will not works. i am giving the upload path ../upload . When i try to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.