Select to view content in your preferred language

Limit attachment size

2343
3
04-14-2016 02:02 PM
aubinmaynard
Deactivated User

How do I go about limiting the size and type of attachments for a specific service? I am working with the Editor widget with simple toolbar sample.  I know this should be straight forward, but I cannot find anything on the the subject.

Thanks!

Tags (2)
0 Kudos
3 Replies
EvelynHernandez
Frequent Contributor

I dont understand ur question , but i worked with attachments before.

U must specified:

    • Content Type: JPEG, PNG, PDF, etc
    • Size: 470812 (in kb )

I remember in flex i worked with bytearrays to add the files at the server.

0 Kudos
aubinmaynard
Deactivated User

Let me clarify:

how do i modify the edit sample

Edit rivers and waterbodies

to only allow a user to upload 1 photo less than 1 mb in size?

0 Kudos
EvelynHernandez
Frequent Contributor

when u capture the pic that u want to upload in ur app u have the following 2 steps:

1st: see the file size. How it has to be less than 1mb before u upload it to the service, u need to see the var myvar.size of the file < than 10000 (in kb).

2nd: if the size is ok, then u have to check if the feature that u wanna add the attachment it has attch already, so u can do that with queryAttachmentInfos. So if the result returns an array with 1 or more results for that feature, u need to delete them or not let the user upload the pic. In the case if u wanna overwrite ur pic, u need to delete all the attachments related to that feature and then upload ur pic.

I hope this help.

0 Kudos