[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] File upload
At 09:16 02-10-2002 +0100, you wrote:
>Marco Mescoli [m.mescoli@omnibit.nu] wrote:
>>
>> I have searched in construct, in admin pages and in the mailing list
archive
>> without clear and simple results.
>> How can i make file upload with IC tags ?
>>
>Here are a couple of untested blocks of code. Create two pages
>as follows:
>
>testpage.html:
>--------------
>
><form action="[process-target]" method="POST" enctype="multipart/form-data">
> <input type="hidden" name="mv_session_id" value="[data session id]">
> <input type="hidden" name="mv_todo" value="return">
> <input type="hidden" name="mv_nextpage" value="@@MV_PAGE@@">
>
> [L]File to upload[/L]:
> <input type="file" name="uploaded_file">
>
> <br><br>
> <input type="submit" name="mv_check" value="[L]Upload file[/L]">
></form>
>
>[set [L]Upload file[/L]]
> mv_nextpage=testpage_upload
>[/set]
>
>
>testpage_upload.html
>--------------------
>
>[if type=explicit compare="[value-extended
> name=uploaded_file
> test=isfile
>]"]
>[then]
> [tmp result][value-extended
> Yes=Success
> No=FAILED
> ascii=0
> name=uploaded_file
> outfile="tmp/test_file"
> ][/tmp]
> [if scratch result eq 'Success']
> [tmp result][L]File upload succeeded.[/L][/tmp]
> [else]
> [tmp result][L]File upload failed.[/L][/tmp]
> [/else]
> [/if]
>[/then]
>[else]
> [tmp result][L]No file upload was specified.[/L][/tmp]
>[/else]
>[/if]
>[scratch result]
>
>
>The first page should present a form and allow you to specify a file
>to be uploaded. When you press the "Upload file" button, you should
>be taken to the second page.
>
>The second page should save the uploaded content to "tmp/test_file"
>and show a success/failure message.
>
Hi Kevin,
You did me a great pleasure with this code too!
Is there a way to not have the file given a 'static' name as happenes in
'outfile="tmp/test_file"'?
Because when the first customer uploads an image it will be called
test_file, but when the second also uploads an image it will overwrite the
first test_file.
The second thing: when I check the order of a customer who uploaded an
image, how will I know that he did so? Could I make it part of the orders
list?
Thanks, Saske