PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I need some help. this program will ulpoad a .txt file, however i'm trying to make it uplaod the file to a text area.
how can i do this?
thanks to all!
jameslat wrote: i'm trying to make it uplaod the file to a text area.
how can i do this?
thanks to all!
I don't know what that means. A text area is an HTML element. "Uploading" a file means making a copy of the file on the server. There is no connection between the two. What is it you are trying to do?
i revised the code a little bit. basicaly i'm trying to get the file to be laoded into the text feild.
if u run this code as is it will load the text file, but not in the textarea box.
how can i make the file laod in the text area box?
thanks again.
You'll have to write the code that determines where the uploaded file is to be stored on the computer, including what filename it will have, then you can include that file in the html textarea. There's a fair amount of php code required to do that. Read a tutorial about uploading files with php. There are a lot of decisions you'll have to make, like whether you're going to keep these files on the server forever, how you're going to name them, etc.
ok, but i'm not tying to uplaod a file.
i'm trying to take an existing file (that's already on the server) and load the code to a textarea feild.
how can i do this?
thanks.
Your code says "Upload your .txt file" and your submit button says "Upload", but now you're saying you're not trying to upload a file? Could have fooled me.
So I have to guess that you're doing this on your own, local server. Otherwise, you couldn't expect a web visitor to know what filename and path to specify, right? In that case, all you need to do is use PHP to include the text file in the HTML textarea element (between the opening and closing tags):
because it's the closing parenthesis for the isset() function.
To help you with coding PHP, think of error messages as your friends! When it says "parse error" it's telling you that it can't understand what you want because you have not followed the syntax rules. So look for things like missing semicolons (;) at the end of lines, or unmatched brackets or parentheses (in this case) or only part of the statement, etc. Then you will find your errors fast. Since I was doing that one in my head, my head didn't give me any parse error.
califdon wrote:Yup, even us old-timers slip up now and then. But mikosiko got the wrong place to add the parenthesis. It needs to go before the "?" like this:
because it's the closing parenthesis for the isset() function.
To help you with coding PHP, think of error messages as your friends! When it says "parse error" it's telling you that it can't understand what you want because you have not followed the syntax rules. So look for things like missing semicolons (;) at the end of lines, or unmatched brackets or parentheses (in this case) or only part of the statement, etc. Then you will find your errors fast. Since I was doing that one in my head, my head didn't give me any parse error.
nah... just testing if you were awake ... (no really.. I had a brain f a r t )