On Monday, March 13, 2017 at 12:10:32 PM UTC-7, Mika Sjöman wrote:
>
> Hi and thanks :)
>
> Ill try that later. But I need to keep the image outside of the db (not in 
> a blob field), and only keep a reference to the location of the image on 
> the disk. I am going to run a python script on the image I am uploading to 
> do OCR analysis triggered by the Scheduler, so I need the image on the 
> disk. How can I move the image to somewhere on the disk instead of saving 
> it in the db?
>
> Cheers
>


We may need to know more about your React Native tool.  If you were using 
the Web2Py upload support, it would (unless told otherwise) end up in a 
file, and whether you used defaults or specified a location you'd know 
where that file was.  It might help to look at the network traffic for the 
uploads, and see what URL the post is using.  (The browser's DevTools 
console should have a Network tab.  You can get to the console via 
right-click->inspect element on the page you're using.)

I've had the briefest intro to React, so I don't know much about your 
component.

Is this a mobile app, BTW? 

/dps

 

>
> On Monday, March 13, 2017 at 5:42:07 PM UTC+1, Leonel Câmara wrote:
>>
>> Something like this should work (I haven't tested it).
>>
>> # Model
>> db.define_table('my_uploads',
>>     Field('upload_field', 'upload')
>> )
>>
>>
>> # Controller
>> def upload():
>>     """ Store the upload and return an URL to see the new file """
>>     stored_name = db.my_uploads.upload_field.store(request.vars['file[]'
>> ])  # Note that Field.store works fine with cgi.FieldStorage
>>     db.my_uploads.insert(upload_field=stored_name)
>>     return URL('default', 'download', args=stored_name, scheme=True, host
>> =True)
>>
>>
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to