Sebastian Pfohl
|
Posted: 02/07/2001, 11:34 AM |
|
How can i upload files with the help of codecharge ?
I want to generate a PHP/MySQL Katalog System, the Administrator of this
Katalog should be able to upload the images for this katalog from a normal
html formular (i know its php )
I know there are such things on PHP.Net, but it would be great when anyone
can explain or can give me tips how i can make this with CodeCharge.
The Image File shoul be uploaded to the server and the Filename should be
parsed to the MySQL Database for ...
|
|
|
Alexey Alexapolsky
|
Posted: 02/08/2001, 3:54 AM |
|
Hello Sebastian
You wrote :
> How can i upload files with the help of codecharge ?
>
> I want to generate a PHP/MySQL Katalog System, the Administrator of this
> Katalog should be able to upload the images for this katalog from a normal
> html formular (i know its php )
> The Image File shoul be uploaded to the server and the Filename should be
> parsed to the MySQL Database for ...
First you will need to create html file with upload form , it should look
like this :
<FORM ENCTYPE="multipart/form-data"
ACTION="http://127.0.0.1/cc/php/test.php" METHOD=POST>
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="10000">
Send this file: <INPUT NAME="userfile" TYPE="file">
<INPUT TYPE="submit" VALUE="Send File">
</FORM>
Now you need to run CodeCharge, open page that is supposed to process upload
,
now you only need to add some simple code. Click on Form properties icon ,
select "Events" tab , select "Open" event.
And enter your code for upload handling , if without sophistication , it
might look so :
echo "<hr>Userfile".$userfile." Filename:".$userfile_name;
if (rename($userfile,"c:/images/$userfile_name))
echo "<br> Upload sucessfull";
} else
echo "<br>Upload failed"
You will need to rename file , otherwise php will remove file $userfile
after script is over.
Note : file variables like $userfile will not be set if upload is not
successfull. Php has a variable for limitation of upload file size.
Regards,
Alexey
CodeCharge Support
|
|
|
|