2

While uploading the image of too small size e.g when i crop the image Transloadit server always reply with this response.

{"error":"FILE_FILTER_DECLINED_FILE","message":"One of your files was declined","reason":"file_0"}

I also tried testing response by adding STEP in the ASSEMBLY with force_accept parameter considering(hoping) that it will accept any file size. But still getting the same response.

Here is the code snippet :

Transloadit *transloadit = [[Transloadit alloc]init:TRANSLOADIT_API_KEY];
AssemblyBuilder *assembly = [[AssemblyBuilder alloc]init];
[assembly setTemplateID:TRANSLOADIT_TEMPLATE_ID];
NSData *imgData = UIImageJPEGRepresentation(imageToUpload, 1.0f);
NSError* error;


//Add a file to be uploaded with autogenerated key
[assembly addFile:imgData withError:error];
if(error!=nil)
    TRANSLOADIT_LOG_ERROR(self.class,error);

NSObject<IStep>* step=[[Step alloc] init];
[step setOptionKey:@"robot" object:@"/image/resize"];
[step setOptionKey:@"width" object:@(75)];
[step setOptionKey:@"height" object:@(75)];
[step setOptionKey:@"resize_strategy" object:@"pad"];
[step setOptionKey:@"background" object:@"#000000"];
[step setOptionKey:@"force_accept" object:[NSNumber numberWithBool:YES]];


//Add the step to the assembly
[assembly addStepName:@"thumb" step:step];


//Invoke assembly, and wait for the result
TransloaditResponse* response =[transloadit invokeAssembly:assembly withError:error];
if(error!=nil)
{
    TRANSLOADIT_LOG_ERROR_WITH_MESSAGE(self.class,@"Error has occured while completing assembly");
}

if([response isSuccess])
{
     // success code
}
else
{
     // failure code
}

If someone can help me. Thanks :)

cyberlobe
  • 1,783
  • 1
  • 18
  • 30
Dhaval H. Nena
  • 3,992
  • 1
  • 37
  • 50

1 Answers1

1

This error can only surface if you use the file/filter robot to restrict what files can be uploaded. While I don't see you using it in your code, it might very well be used inside the saved template instructions you're referencing by TRANSLOADIT_TEMPLATE_ID

kvz
  • 5,517
  • 1
  • 42
  • 33
  • thanks !! so it is the issue of saved template ? Do I need to make any changes in the code above ? – Dhaval H. Nena Jun 06 '15 at 04:44
  • 1
    I'm positive it's in the template, yes. The code otherwise looks fine concerning your problem - but I have to admit I'm no good when it comes to objective-c :) – kvz Jun 06 '15 at 08:46