Hi,

I am following the Head First book on PHP/MySQL and ran into a question on setting up folders for uploading images to the web to be used in a database application. The book states, "Use an FTP program to access the file system of your web site and create the images folder beneath the web folder of the application.

  1. Why do I need to use FTP when I can just go into the control panel and create the images folder and upload my images using the file upload process?
  2. The files currently upload to the public_html folder. So when the book says create the images folder beneath the web folder does that mean as a subdirectory inside the public_html folder or inside the www folder?
  3. Or does it mean I just create the images folder at the same level?

Thanks in advance for your kind help!
Shanna

Recommended Answers

All 2 Replies

Hi,

Ans 1. FTP is a lot faster than your conventional file management in cpanel. It will be a lot easier to change file and directory permission using FTP program e.g. filezilla.

Ans 2. Yes, anything that refers to instruction such as create a new directory in your root directory.. will be beneath the public_html directory (please read extra info. below). The reason is that above public_html are not viewable to the browser. However, there are cases where some scripts e.g. php, perl can be placed above the public_html, but that out of the scope of your question.

Ans3. The image directory should be created inside the public_html directory.. Normally, your hosting provider will tell you where to put all of your files, but by default it is the public_html.

Extra info.

file permission. sometimes, books will instruct you to give permission to files or directory. To change or set permission to specific directory or files using FTP, just right click on the directory or file, and then select file permission.. type in the number suggested by the author.. e.g. 0777, 777, 0755, 755. again it all depends on server settings e.g apache module, cgi or fast cgi. Most servers, will assign persmission to a newly created directory with 755.. again it all depends in the server configuration.. e.g apache module or fast cgi?

In environment like shared hosting account, you would notice that you can easily add new domains under one account. So, the files inside the public_html belongs to the domain used when you signed up for your hosting account. The additional domains under this account will have their own directories within the public_html directory e.g seconDomainDotCom.

If yo will be working on those added domains or sub-domains, the root specific to each domain is the directory of that domain.. While, the root of your main account is the public_html

Public_html
-->this area here is the root of main account.
if addon domain is enabled, you can also find someDomainDotCom here..
-->DomainTwo
----> this is root of domain two
-->Domain Three
----->This is root of domain three.

commented: well done! +4

Great!! Thanks super answer. I appreciate the quick response.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.