How to upload a file?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to upload a file?

MarioF
Hi all,

I need that the users of the Webstore can upload some files and then ofbiz has to forward these files to other servers.

I tried this using the UploadCategoryImage (application/product/wabapp/catalog/WEB-INF/controller.xml). This looks like:

<request-map uri="UploadCategoryImage">
        <security https="true" auth="true"/>
        <response name="success" type="view" value="EditCategory"/>
</request-map>

In my ftl file I write the following (similar to the information in product/webapp/catalog/category/EditCategory.ftl):

<script language="JavaScript" type="text/javascript"> function setUploadUrl(newUrl) { var toExec = 'document.imageUploadForm.action="' + newUrl + '";'; eval(toExec); }; </script>               
       
<div class="screenlet-body">
<form method="post" enctype="multipart/form-data" action="<@ofbizUrl>UploadCategoryImage?productCategoryId=${productCategoryId?if_exists}&upload_file_type=category</@ofbizUrl>" name="imageUploadForm">
                                       
                    <input type="file" size="50" name="fname"/>
                    <br/>
                    <input type="submit" class="smallSubmit" value="Upload File"/>
               
        </form>
</div>


But making this I received the following error when I try to upload a file:

Content: null [UploadCategoryImage] is not a publish point for the current website: eCommerce Web Site [WebStore]

I made the same with <security https="false" auth="false"/> and I get the same result.

So, my questions are:

- Is there a better way to do this?
- Which code is being executed the UploadCategoryImage in controller.xml? What happen after ofbiz reach <request-map uri="UploadCategoryImage">?

Thanks in advance,
Mario.  



Reply | Threaded
Open this post in threaded view
|

Re: How to upload a file?

Sumit Pandit-3
Hi Mario, I am not sure but file uploading process at - https://demo.ofbiz.org/sfa/control/NewLeadFromVCard would help you as a reference in upload your file.

--
Thanks And Regards
Sumit Pandit
On Dec 16, 2009, at 1:24 AM, MarioF wrote:

>
> Hi all,
>
> I need that the users of the Webstore can upload some files and then ofbiz
> has to forward these files to other servers.
>
> I tried this using the UploadCategoryImage
> (application/product/wabapp/catalog/WEB-INF/controller.xml). This looks
> like:
>
> <request-map uri="UploadCategoryImage">
>        <security https="true" auth="true"/>
>        <response name="success" type="view" value="EditCategory"/>
> </request-map>
>
> In my ftl file I write the following (similar to the information in
> product/webapp/catalog/category/EditCategory.ftl):
>
> <script language="JavaScript" type="text/javascript">
>        function setUploadUrl(newUrl) {
>        var toExec = 'document.imageUploadForm.action="' + newUrl + '";';
>        eval(toExec);
>        };
> </script>
>
>
> <div class="screenlet-body">
> <form method="post" enctype="multipart/form-data"
> action="<@ofbizUrl>UploadCategoryImage?productCategoryId=${productCategoryId?if_exists}&amp;upload_file_type=category</@ofbizUrl>"
> name="imageUploadForm">
>            <table cellspacing="0" class="basic-table">
>                <tr><td>
>                    <input type="file" size="50" name="fname"/>
>                    <br/>
>                    <input type="submit" class="smallSubmit" value="Upload
> File"/>
>                </td></tr>
>            </table>
>        </form>
> </div>
>
>
> But making this I received the following error when I try to upload a file:
>
> Content: null [UploadCategoryImage] is not a publish point for the current
> website: eCommerce Web Site [WebStore]
>
> I made the same with <security https="false" auth="false"/> and I get the
> same result.
>
> So, my questions are:
>
> - Is there a better way to do this?
> - Which code is being executed the UploadCategoryImage in controller.xml?
> What happen after ofbiz reach <request-map uri="UploadCategoryImage">?
>
> Thanks in advance,
> Mario.  
>
>
>
>
> --
> View this message in context: http://n4.nabble.com/How-to-upload-a-file-tp964967p964967.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.