Saving a Image file
6 posts
• Page 1 of 1
Saving a Image file
Hellow, Good Afternoon!
I submited a img file(.png,.jpg) to server (apl 18.2 / MiServer):
<input type="file" id="imgFile" name="imgFile" accept="image/png, image/jpeg, image/bmp, image/gif" class="w3-margin-top et-text-azulmed">
The MiServer received with success in a two elements variable (imgFile). The first element is the file name and the second, the file content.
My difficult is How to save this file in a directory, for example: c:\Temp
Could somebody help me, please?
// Marco Gantois
I submited a img file(.png,.jpg) to server (apl 18.2 / MiServer):
<input type="file" id="imgFile" name="imgFile" accept="image/png, image/jpeg, image/bmp, image/gif" class="w3-margin-top et-text-azulmed">
The MiServer received with success in a two elements variable (imgFile). The first element is the file name and the second, the file content.
My difficult is How to save this file in a directory, for example: c:\Temp
Could somebody help me, please?
// Marco Gantois
- Gantois
- Posts: 90
- Joined: Thu Apr 17, 2014 9:44 am
Re: Saving a Image file
Hi Marco!
If I understand your question correctly, you should be able to do something along the lines of:
You may need to add code to deal with if the file already exists - do you delete and overwrite, rename, etc?
I hope this helps!
/Brian
If I understand your question correctly, you should be able to do something along the lines of:
(name content)←imgFile
tn←('c:\Temp\',name) ⎕NCREATE 0
content ⎕NAPPEND tn
⎕NUNTIE tn
You may need to add code to deal with if the file already exists - do you delete and overwrite, rename, etc?
I hope this helps!
/Brian
-
Brian|Dyalog - Posts: 120
- Joined: Thu Nov 26, 2009 4:02 pm
- Location: West Henrietta, NY
Re: Saving a Image file
Hello Brian,
You perfectly understood my question.
I already used ⎕ncreate ⎕nappend ... but not for image files.
Very simple solution. I have already implemented in my site.
Thanks!!!!
Cheers,
Marco Gantois
You perfectly understood my question.
I already used ⎕ncreate ⎕nappend ... but not for image files.
Very simple solution. I have already implemented in my site.
Thanks!!!!
Cheers,
Marco Gantois
- Gantois
- Posts: 90
- Joined: Thu Apr 17, 2014 9:44 am
Re: Saving a Image file
Hi Brian,
My site frequently replace images with the same file name (⎕NERASE / ⎕NCREATE) but the browsers do not recognize the new image unless the cache is cleared.
Do you known what could I do to solve this issue? Perhaps changing some file attribute after create it. If so, how could I do this by apl? Do you have any recommendation for this purpose, please?
Thanks
Cheers,
Marco Gantois
My site frequently replace images with the same file name (⎕NERASE / ⎕NCREATE) but the browsers do not recognize the new image unless the cache is cleared.
Do you known what could I do to solve this issue? Perhaps changing some file attribute after create it. If so, how could I do this by apl? Do you have any recommendation for this purpose, please?
Thanks
Cheers,
Marco Gantois
- Gantois
- Posts: 90
- Joined: Thu Apr 17, 2014 9:44 am
Re: Saving a Image file
Hi Marco,
There are a number of techniques to accomplish this. I found this on stackoverflow. I don't understand your specific use case well enough to recommend a particular technique, but that link should get you going. If you have further questions, it might help for you to send me a copy of your MiPage.
I hope this helps!
/Brian
There are a number of techniques to accomplish this. I found this on stackoverflow. I don't understand your specific use case well enough to recommend a particular technique, but that link should get you going. If you have further questions, it might help for you to send me a copy of your MiPage.
I hope this helps!
/Brian
-
Brian|Dyalog - Posts: 120
- Joined: Thu Nov 26, 2009 4:02 pm
- Location: West Henrietta, NY
Re: Saving a Image file
Hi Brian,
Thanks for the tips / instructions and the prompt return.
In my case we have thousand images with only a few differents names in differents paths.
I solved the issue complementing the <img src=" " > with (?v=',(⍕⎕ts)~' ') as following (used in a reading function / last line):
∇ src←SrcImg (idq nomarq);src
:If nomarq≡'imgconfig.png'
src←'/Img/',nomarq
:ElseIf '3'=1↑idq
src←'/Database/',idinstit,'/',idescola,'/IMG/',idq,'/',nomarq
:Else
src←'/Database/',(4↑idq),'/IMG/',idq,'/',nomarq
:EndIf
src←src,'?v=',(⍕⎕ts)~' '
∇
Cheers,
Marco Gantois
Thanks for the tips / instructions and the prompt return.
In my case we have thousand images with only a few differents names in differents paths.
I solved the issue complementing the <img src=" " > with (?v=',(⍕⎕ts)~' ') as following (used in a reading function / last line):
∇ src←SrcImg (idq nomarq);src
:If nomarq≡'imgconfig.png'
src←'/Img/',nomarq
:ElseIf '3'=1↑idq
src←'/Database/',idinstit,'/',idescola,'/IMG/',idq,'/',nomarq
:Else
src←'/Database/',(4↑idq),'/IMG/',idq,'/',nomarq
:EndIf
src←src,'?v=',(⍕⎕ts)~' '
∇
Cheers,
Marco Gantois
- Gantois
- Posts: 90
- Joined: Thu Apr 17, 2014 9:44 am
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group