Welcome to Portal

?Unknown\pull-down

Welcome to Zoho Cares

Bienvenido a Soporte de Zoho

Search our knowledge base, ask the community or submit a request.

Hello I am trying to upload a file from creator into my zoho workdrive but it does not seem to be working.  A file does get uploaded but there is nothing when I try to look at it and just gives an error message saying "We couldn't generate a preview due to a mismatch in the file extension and the actual file format.". How would I fix this?

row.Temperature_Log is a file upload field

Deluge code in creator:
tempFile = row.Temperature_Log;
fileName = row.Temperature_Log.acualname;
activeLogFolder = "0ca1f1e84ba0689a14289829fbf6600e6ee18";
if(tempFile != null)
{
myResp = zoho.workdrive.uploadFile(row.Temperature_Log,activeLogFolder,fileName + " " + input.Customer,false,"writerconnection");
attributes = myResp.getJSON("data").getJSON("attributes");
strLocation = attributes.getJSON("Permalink");
fileID = attributes.getJSON("File INFO").getJSON("RESOURCE_ID");
row.Log_Added=zoho.currenttime;
row.Docs_Upload_ID=fileID;
row.Zoho_Docs_Temp_Log="<a href='" + strLocation + "' target='_blank' title='Docs Temp Log'>Go to Temp Log from " + row.Log_Added + "</a>";
row.File_Name=fileName;
alert "File Uploaded to Workdrive";
}


1 user has this question.
14 Replies
Reply
3 more
  • 2 years ago

 it is still not working when I try "On Success" and I am just uploading a regular jpeg. Here's a screenshot:

  • Zoho MVP
  • 2 years ago

The only thing that stands out is your file name, try give it a simple filename and see if that solves it.

  • 2 years ago

 I tried that as well it did not seem to work but I contacted zoho and it might be an issue on their end looks like

Were you ever able to get this resolved? I'm having the same issues. Thanks. 

  • 2 years ago

  I don't seem to remember what was causing the problem but here is the new code that works for me. I used a for loop to go through a the files because I am using a subform but in your case you might not need it.

  1. templog_folder = "folder id here";
  2. for each  log in Temperature_Logs
  3. {
  4. if(log.Temperature_Log != null && log.Uploaded == false)
  5. {
  6. tempFile = log.Temperature_Log;
  7. fileName = log.Temperature_Log.actualname;
  8. myTempLog = zoho.workdrive.uploadFile(tempFile,templog_folder,fileName,false,"writerconnection");
  9. attributes = myTempLog.getJSON("data").getJSON("attributes");
  10. myID = attributes.getJSON("File INFO").getJSON("RESOURCE_ID");
  11. link = attributes.getJSON("Permalink");
  12. log.Docs_Upload_ID=myID;
  13. log.File_Name=fileName;
  14. log.Zoho_Docs_Temp_Log="<a href='" + link + "' target='_blank' title='Docs Temp Log'>Go to Temp Log from " + log.Log_Added + "</a>";
  15. log.Uploaded=true;
  16. }

  • 1 year ago

Hi,

From the screenshot I see the file name be : "Think21-2.jpeg Mirko"
We should read "Think21-2.jpeg"

Workdrive can't make a preview because it sees the image being of "jpeg Mirko" file type.

In you first script
  1. myResp = zoho.workdrive.uploadFile(row.Temperature_Log,activeLogFolder,fileName + " " + input.Customer,false,"writerconnection");

You append input.Customer to the filename. This is the problem !
  1. fileName + " " + input.Customer
if the file name is "Think21-2.jpeg"
the script change the filename to "Think21-2.jpeg Mirko", which is an incorrect filename.

Use
  1. myResp = zoho.workdrive.uploadFile(row.Temperature_Log,activeLogFolder,fileName,false,"writerconnection");

Or if you need to have the customer name in the file, better prepend it like
  1. myResp = zoho.workdrive.uploadFile(row.Temperature_Log,activeLogFolder,input.Customer + " " + fileName,false,"writerconnection");

Hope this helps, regards.

  • 17 days ago

How did you create the connection "writerconnection"?  I can't find a connection between Creator and Workdrive and I'm looking to upload files/images that are uploaded into a Creator Form into Workdrive.  I want to use the URLs in another application outside of the Zoho ecosystem and can't seem to get a reliable public URL.   Thank you.

  • Zoho MVP
  • 12 days ago

In your setup, you will find the connections module where you can create connections

  • 12 days ago

Right, but Writer isn't an option there for me.

  • Zoho MVP
  • 12 days ago

Use Zoho OAuth and you will see the writer scopes

  • 12 days ago

Thank you!

Reply to MirkoA
/* */
  • 12
  • Insert
  • Plain text
Add Comment
(Up to 20 MB )