Local upload to react-avatar-editor - reactjs

I would need a brief hint on how to load a local uploaded file (via ) to react-avatar-editor.
I suppose I have to pass something related to FileReader as a prop.image to , but looking to the source code I didn't figure it out.

Related

File upload and attach in Acumatica

I'm actually new in Acumatica Framework. I'm having some issues to understand how to attach the file. The problem is that in this answer Attach file to data row they talk about
PXNoteAttribute.SetFileNotes(Base.Caches[typeof(DAC)], dacRecord, file.UID.Value);
I do not understand what do they refer about "Base.Caches[typeof(DAC)], dacRecord", I've already saved the file but the step of setting the file is my problem...
You need to provide the Cache object corresponding to the type of your Record and the Record itself. For example if you need to attach file to SOOrder you will provide values like below:
var currentSOOrder = soOrderEntry.Document.Current;
PXNoteAttribute.SetFileNotes(soOrderEntry.Caches[typeof(SOOrder)], currentSOOrder , file.UID.Value);

Export Data to file in GNU Radio Companion

I have run into a slight problem with GNU Radio. I inserted a “File Sink” block into GNU Radio companion. I was receiving data last week, but coming back to the classroom today, I am not able to execute the file anymore. Do you have any idea what is wrong?
Basically, what I am trying to do, is export data created from GRC file using a file sink block to export the data to a file. That file, using python to parse through the data, will then be uploaded to a database. My problem is now that I cannot execute the file to export the data.
Below is some data from the Python script associated with the File Sink
audiodata = gr.file_sink(gr.sizeof_float, "audio.dat")
self.connect(src0, audio)
audiodata = gr.file_sink(gr.sink(gr.sizeof_complex, "audio.dat")
Below is a link of my GRC File.
http://i58.tinypic.com/10wv78z.png
If anyone has a better way to export the data from GRC, please let me know.
The second line of python looks broken. Where did you get it from? I haven't seen a bug in GRC's python code generation yet, so this is surprising.
Regarding the red arrow: This most probably indicates that something is wrong with the data type of the file sink. You should set the type to float, set it back to complex, and see if that solved the problem. If it did not, then your GRC file is broken, and you'll either need to manually look at the XML or re-build it from scratch, sorry :(
I have not seen XML corruption in GRC, either, so please make sure your data storage is not corrupted.
I think the second line should be
self.connect(src0, audiodata)
The lines looks similar to Capturing Signals in GNU Radio.pdf available in internet

Modify Filename Before Saving in Django using model.FileField

I have a model.FileField(upload_to='%Y/%m/%d') field. This works great; however, I want to rename the file based on the context of the user uploading the file before it is saved. Is there a way of modifying the request object before it saved to accomplish this?
I have come across people with similar issues but the answers always point back to the Django documentation. I have tried figuring this out using the documentation but can't. Can someone provide some code to show hot to solve this?
Thanks in advance.
you can use function for upload_to value with instance and filename inputs and return path and file name
for example:
def upload_to_func(instance, filename):
now = datetime.now()
return os.path.join(str(now.year), str(now.month), str(now.day), filename)
field_x = model.FileField(upload_to=upload_to_func)
you can change path and filename in function

Render file Rails3

I'm trying to render a png file in a controller in Rails3. I'm using:
render :file=>'public/images/filename.png'
However, the output seems not to be a PNG file (its contents start with "PNG" -checked it with curl- but it's not a valid file). I cannot find documentation on render :file in Rails3. Has the syntax changed for this? Even if it's a MIME type issue, I think I should be able to obtain the file with curl.
I'm using this technique to show a default image when using Fleximage's images if available. Fleximage's images work correctly, but this simple operation does not.
use:
send_file path_to_file

Receive multi file post with google app engine

I want to receive multi file post from image uploader.(i use this)
Most examples show how to receive one image from post.
I tried many ways but never got the results.
For example
self.request.POST['Filename']
gives only first filename.
What to do when there are multiple files/images in post?
The reason for this is to resize before upload images, that are too big for google app engine
to upload.
EDIT:
self.request.POST.multi.__dict__
shows
{'_items':
[('Filename', 'camila1.jpg'),
('Filedata[]', FieldStorage('Filedata[]', 'camila1.jpg')),
('Upload', 'Submit Query\r\n--negpwjpcenudkacqrxpleuuubfqqftwm----negpwjpcenudkacqrxpleuuubfqqftwm\r\nContent-Disposition: form-data; name="Filename"\r\n\r\nbornToBeWild1.jpg'),
('Filedata[]', FieldStorage('Filedata[]', 'bornToBeWild1.jpg')),
('Upload', 'Submit Query')]}
Your flash uploader is designed to work with PHP and sends multiple Filedata[] fields (php interprets this as an array for easy access)
So you need to iterate and get them all:
def post(self):
for file_data in self.request.POST.getall('Filedata[]'):
logging.info(file_data.filename)
data should be file_data.value
Are you using the Django libraries available to you? If so, check this out.
Call self.request.POST.getall('Filename') to get a list of FieldStorage objects; each one contains one file. You can access the file data with .value, the name with .name, and the mimetype with .type.
I have no idea how that multi uploader works, I have made one in the past however and I just added a number on the end of input field name, then hide it. Then add a new file input field to add another file. The reason for this is that they don't let you play around with input file fields to much because you could make it upload files they didn't want you uploading.
Using my conventions, in your example the 2 files in your example would be "Filename0" and "Filename1". You could also use firebug to see what it renaming the input file fields to.
Edit: I had a look, and it's using flash. So i have no idea how it works.

Resources