On 3/5/06, Tom Rhodes <[EMAIL PROTECTED]> wrote:
>
> jim wrote:
> > I only need the ability to change the name of the file that is being
> > uploaded. How would I go about this? I tried changing the [FileReference
> > instance].name field but this is read only. On the php side I am not
> sure if
> > I can pass through other data with the file data.
> I did this with the php file...
>
> <?php
> if ($_FILES['Filedata']['name']) {
>    $uploadDir = $_REQUEST['dir']."/";
>    $uploadFile = $uploadDir . basename($_REQUEST['fileName']);
>    $uploaded = move_uploaded_file($_FILES['Filedata']['tmp_name'],
> $uploadFile);
>    echo $uploaded;
> }
> ?>
>
> and the line in the flash like so...
>
> file.upload("../../assets/php/uploadFile.php?fileName=" + theFileName +
> "&dir=" + theDir
>
> this way i was controlling the directory the files went into and the
> filenames of the uploaded files from the flash rather than the php.
>

I hope this was just a simple example, and on your real server, you have
some checks in the php code, so people can't just upload files and overwrite
whatever they want... (imagine a hacker overwriting index.html with one that
downloads some spyware into visitors computers, or steals peoples passwords,
or overwrites every single file on your server, etc)

-David R
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to