Title:
Bug 85895:(Watson Migration Closure)Content-Type is not set appropriately when writing to S3
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Henry Ho / Henry Ho (Henry Ho)
Created: 01/18/2011
Components: File Management, VFS-S3
Versions: 9.0.1
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 / CF11 Update5
Priority/Frequency: Normal / Unknown
Locale/System: English / Platforms All
Vote Count: 1
Problem:
Content-Type is not set appropriately when writing to S3. It is always "application/octet-stream", which might not work for some browser.
Method:
if we dont set the content type all file are uploaded to s3 with appplication/octect as the content type. The below code works
<cfif isDefined("Form.FileContents") >
<!--- If TRUE, upload the file. --->
<cffile action = "upload"
fileField = "FileContents"
destination = "s3://cfbugstest/taj.jpg"
accept= "image/jpeg"
nameConflict = "MakeUnique">
<cfset meta= storeGetMetadata("s3://cfbugstest/taj.jpg")>
<cfdump var="#meta#">
<cfelse>
<!--- If FALSE, show the Form. --->
<form method="post" action=<cfoutput>#cgi.script_name#</cfoutput>
name="uploadForm" enctype="multipart/form-data">
<input name="FileContents" type="file">
<br>
<input name="submit" type="submit" value="Upload File">
</form>
</cfif>
But if you set content type in accept of cffile the code will not work
<cfif isDefined("Form.FileContents") >
<!--- If TRUE, upload the file. --->
<cffile action = "upload"
fileField = "FileContents"
destination = "s3://cfbugstest/taj.jpg"
nameConflict = "MakeUnique">
<cfset meta= storeGetMetadata("s3://cfbugstest/taj.jpg")>
<cfdump var="#meta#">
<cfelse>
<!--- If FALSE, show the Form. --->
<form method="post" action=<cfoutput>#cgi.script_name#</cfoutput>
name="uploadForm" enctype="multipart/form-data">
<input name="FileContents" type="file">
<br>
<input name="submit" type="submit" value="Upload File">
</form>
</cfif>
Result:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3043111
External Customer Info:
External Company:
External Customer Name: Henry Ho
External Customer Email: 237A22C24921EDF5992015B9
External Test Config: 01/18/2011
Attachments:
Comments: