Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
failed to open stream: No such file or directory
Old 05-31-2009, 12:40 PM failed to open stream: No such file or directory
Novice Talker

Posts: 6
Name: Danielle
Trades: 0
Hey so I'm so stuck on how to get these files in my directory root/papers

I am getting a warning that there is no such directory, any suggestions?

require("connect.php");
$paperTMP= $_FILES['paper']['tmp_name'];
if(is_uploaded_file($paperTMP)){
if($_FILES['paper']['type']== "application/msword"){
//creating folder
while (1){
$folder= rand(1000,1000000);
$result= mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM `jobs` WHERE `folder` = $folder"));
if ($result[0] == 0) {
break;
}
}
mkdir($folder);
chmod($folder, octdec('777'));
$paper= $_FILES['paper']['name'];
move_uploaded_file($paperTMP,"C:/Users/Danielle/Documents/My Webs/optimaledit/papers/".$folder."/".$paper);
dfez44 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-31-2009, 01:24 PM Re: failed to open stream: No such file or directory
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
PHP Code:
require("connect.php");
$paperTMP$_FILES['paper']['tmp_name'];
if(
is_uploaded_file($paperTMP)){
if(
$_FILES['paper']['type']== "application/msword"){
//creating folder
while (1){
$folderrand(1000,1000000);
$resultmysql_fetch_array(mysql_query("SELECT COUNT(*) FROM `jobs` WHERE `folder` = $folder"));
if (
$result[0] == 0) {
break;
}
}
mkdir($folder);
chmod($folderoctdec('777'));
$paper$_FILES['paper']['name'];
move_uploaded_file($paperTMP,"C:/Users/Danielle/Documents/My Webs/optimaledit/papers/".$folder."/".$paper); 
- Use the [php] tags it makes it easier to read the code.
- Did the php debugger say what line the error was occurring (it normally does)

Try adding the file_exists( http://uk3.php.net/manual/en/function.file-exists.php ) to check if the file actually does exist. It could be the space on:
PHP Code:
"C:/Users/Danielle/Documents/My Webs/optimaledit/papers/".$folder."/".$paper 
Try the following code:
PHP Code:
require("connect.php");
$paperTMP$_FILES['paper']['tmp_name'];
if(
is_uploaded_file($paperTMP)){
if(
$_FILES['paper']['type']== "application/msword"){
//creating folder
while (1){
$folderrand(1000,1000000);
$resultmysql_fetch_array(mysql_query("SELECT COUNT(*) FROM `jobs` WHERE `folder` = $folder"));
if (
$result[0] == 0) {
break;
}
}
mkdir($folder);
chmod($folderoctdec('777'));
$paper$_FILES['paper']['name'];
if(
file_exists('C:/Users/Danielle/Documents/My Webs/optimaledit/papers/'.$folder.'/')){ // Note the single quotes, because your nothing processing anything.
move_uploaded_file($paperTMP,'C:/Users/Danielle/Documents/My Webs/optimaledit/papers/'.$folder.'/'.$paper);
} else {
echo 
'Folder ('.'C:/Users/Danielle/Documents/My Webs/optimaledit/papers/'.$folder.'/'.') not found';

__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE

Last edited by rogem002; 05-31-2009 at 01:28 PM..
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 05-31-2009, 01:53 PM Re: failed to open stream: No such file or directory
Novice Talker

Posts: 6
Name: Danielle
Trades: 0
thanks for your feedback, when i typed in the code you gave me i got:

Folder (C:/Users/Danielle/Documents/My Webs/optimaledit/papers/332120/) not foundINSERT INTO `jobs` VALUES(28,NOW(),4,,3,1,30,"",0,"dagf","agfvg",0,0, "art.doc",332120,0)
dfez44 is offline
Reply With Quote
View Public Profile
 
Old 05-31-2009, 02:24 PM Re: failed to open stream: No such file or directory
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Does:
C:/Users/Danielle/Documents/My Webs/optimaledit/papers/332120/ exist on your system?
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 05-31-2009, 03:10 PM Re: failed to open stream: No such file or directory
Novice Talker

Posts: 6
Name: Danielle
Trades: 0
yeah it does, right now im doing it locally, so that is where it is and it does exist. when i do it online i send it to the root folder then the papers folder. that says it doesnt exist either.
dfez44 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to failed to open stream: No such file or directory
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.21297 seconds with 12 queries