<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>63388</bug_id>
          
          <creation_ts>2011-06-25 13:24:05 -0700</creation_ts>
          <short_desc>Using FormData to upload a DataTransferItem generated random filename</short_desc>
          <delta_ts>2011-06-26 00:34:23 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Platform</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>UNCONFIRMED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Alfonso Martínez de Lizarrondo">amla70</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>427421</commentid>
    <comment_count>0</comment_count>
    <who name="Alfonso Martínez de Lizarrondo">amla70</who>
    <bug_when>2011-06-25 13:24:05 -0700</bug_when>
    <thetext>With https://bugs.webkit.org/show_bug.cgi?id=58106 it&apos;s possible to get access to a pasted image in the paste event and as explained here http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-March/030881.html it&apos;s a Blob

Then that Blob can be send to the server with FormData:
	var formdata = new FormData();
	formdata.append(&quot;upload&quot;, file);
	xhr.send(formdata);

But that will set only the name of the form element (&quot;upload&quot;) that can be used at the server to read the file. The filename itself will be a random string like Blob8edfed3b35de4b39a42a69f96081e5d1 that doesn&apos;t include even the &apos;.png&apos; extension

So if the server is performing some basic filtering according to the uploaded filenames, that file will be rejected.
If the server doesn&apos;t add itself the &apos;.png&apos; extension, then it might not be sent back when the client request it (due to a security policy to not send unknown file types)

Possible solutions: 
Generate a more useful automatic filename
allow to specify a filename in the formdata.append, or the blob
allow to get the whole blob as a string and then perform a sendAsBinary like Firefox where we can build the exact form specifying everything</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>