473,396 Members | 2,014 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,396 software developers and data experts.

how to create and open directory in php directory dynamically?

here i have error as,"Undefined index: $opdir in C:\wamp\www\mumtaj\sathya\directory.php on line 15
Directory does not exist"
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $dir=(mkdir("C:\wamp\www\upload3" , 0777));
  3. if($dir)
  4. {
  5.    echo "Directory has been created successfully...";
  6. }
  7. else
  8. {
  9.    echo "Failed to create directory...";
  10. }
  11.  
  12. $opdir=opendir("C:\wamp\www\upload3");
  13. $uploaddir = $_SERVER['$opdir'];        //Now here is the problem, what to give in the //place of '$opdir' ..
  14. echo (file_exists($uploaddir) && is_dir($uploaddir)) ? 'Directory path ok' : 'Directory does not exist';
  15. ?>
  16.  
May 6 '12 #1
5 3216
johny10151981
1,059 1GB
replace your all \ with \\ or instead just use / your problem would be solved
May 7 '12 #2
same problem exist in that after that change too.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $dir=(mkdir("C:/wamp/www/upload34" , 0777));
  3. if($dir)
  4. {
  5.    echo "Directory has been created successfully...";
  6. }
  7. else
  8. {
  9.    echo "Failed to create directory...";
  10. }
  11.  
  12. $opdir=opendir("C:/wamp/www/upload34");
  13.  
  14. $uploaddir = $_SERVER['$opdir'];        //Now here is the problem, what to give in the //place of '$opdir' ..
  15. echo (file_exists($uploaddir) && is_dir($uploaddir)) ? 'Directory path ok' : 'Directory does not exist';
  16. ?>
  17.  
May 7 '12 #3
if ur using windows or linux?
May 8 '12 #4
johny10151981
1,059 1GB
start fixing from line 12

at line 12 you have
Expand|Select|Wrap|Line Numbers
  1. $opdir=opendir("C:/wamp/www/upload34"); 
  2. //$opdir a resource, resource of directory.
  3.  
  4.  
line 14
Expand|Select|Wrap|Line Numbers
  1. $uploaddir = $_SERVER['$opdir'];        //Now here is the problem, what to give in the //place of '$opdir' ..
  2.  
  3. //here uploaddir would get resource $_SERVER don't exists. What does it contain nothing. 
  4.  
read documentation for every function you have used in your php code
May 8 '12 #5
i use windowsXP and WAMP package...
May 22 '12 #6

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

Similar topics

32
by: munanxue | last post by:
I remember that I could create a new folder in the current directory easily in Unix and Linux by something like system("mkdir sub_directory"); But failed to do so under Windows System. Any...
2
by: Nikki | last post by:
Hi, I m developing a Windows application in which i want to create a context menu, having variable number of submenus depending on the the list in the file. I m able to create these submenus at...
3
by: Smitha Nataraj | last post by:
Hello, I need to create a Virtual Directory in C#. Pls let me know if you have any hints regarding this.. Thanks, Smitha
0
by: SampathTangudu | last post by:
Hi, We are trying to use the Hash Tables for passing information from one aspx page to another aspx page. We are using the below code. IsolatedStorageFile isoStore =...
13
by: Mike Fellows | last post by:
im trying to open a directory (as if i had browsed to the directory in windows) from code im checked system.io.directory but there doesnt seem to be an open command (or similar) is there an...
2
by: Frank Jeseit | last post by:
Hi, I have a directory with a webservice project that is not published in IIS. Therefore I'm not able to open the project in VS.NET (2003). My goal is to create a virtual directory in IIS from...
7
by: lakshmi | last post by:
Hi all, i need to open multiple files that are in directory and parse each file.iam using c language in VC++ compiler.how can i open a directory.i tried it by including header file dirent.h.but...
4
by: sudhakaranr | last post by:
HI, Need your help please... First thing, i want to open a directory and with in the directory i have 1000's of files and we need to read the file and i want a particular line which has...
2
by: marcusadeleon | last post by:
Hi, I was wondering how to open up a web directory to get a file listing. The directory I want to open allows directory listings, but has a directory password. Meaning it gives me a prompt to...
1
by: Dinesh Sivaling | last post by:
Hi everyone I want to open the Directory like this using C++ in linux eg : /proc/1/status where proc and 1 is a directory and status is a file,which i want to access(i.e)this file i have to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...
0
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...
0
tracyyun
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...

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.