View Full Version : Beginner's php questions please

05-23-2011, 02:24 PM
I am confused here concerning the opening and editing of files. If you are designing a website using php coding, you name this file's extension .php not so? If yes, according to the tutorials, why use php coding to open and edit a .txt file when you can simply do so using notepad?

05-23-2011, 02:32 PM
I don't know why you're asking about using php to open a .txt file. You might do this if you want your script to automatically read / edit a file on the server (EG a log file) but this is different from doing things manually using notepad.

Also you may be getting confused with how to edit a .php file. This is done in notepad (or similar) where you edit your code and then save it.

To recap:
php files are named with a .php extension. To open and/or edit you use a text editor.

05-23-2011, 11:19 PM
ok got it now, I see now how the changes are made to the txt file via the php code, thanks but now the txt file doesn't show any new changes I make to the php code, any reason why?

05-24-2011, 12:20 AM
The txt file.. which one? - We seem to still be talking about 2 different txt files.

When you edit the .php file be sure to save it, when you reopen the changes you made will still be there.

05-24-2011, 03:19 PM
I am working with this script which deals with

PHP - File Upload: move_uploaded_file Function

but need some help in breaking this down where the "names" are concerned which are bolded below:

$target_path = "uploads/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";

Can you advise me on those 3 names issues above please? In other words, those 3 names need to be replaced with what exactly?

05-24-2011, 03:59 PM
Names from your form fields...

Please don't confuse the topic. I've asked you a question about your text files and you've returned with a completely new question which seems to be unrelated.

05-24-2011, 04:00 PM
not exacly sure what your asking here, but if your wanting to use that script with your program, just replace "uploadedfile" with the name of your upload field.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum