<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic uploading to server through flex in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/uploading-to-server-through-flex/m-p/521245#M11841</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am writing a flex app that lets users upload a file to our server remotely. I use the fileReference.upload command to send the file to a server side script (.aspx) that will save it in an 'uploads' folder in the wwwroot on the server. I am having problems getting the server side script to work.. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have NO experience with .NET programming and found this script online:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;dim myFile as HttpPostedFile=Request.Files(0)
myFile.SaveAs(Server.MapPath("~") &amp;amp; "uploads/" &amp;amp; myFile.FileName)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can someone explain why this wont work with fileReference.upload()?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alternatively, I found this script (which includes a form):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;lt;%@ Import namespace="System.IO"%&amp;gt; 
&amp;lt;html&amp;gt; 
&amp;lt;head&amp;gt; 
&amp;lt;title&amp;gt;Uploading a File&amp;lt;/title&amp;gt;&amp;nbsp; 
&amp;lt;script language="VB" runat="server"&amp;gt;

Sub Upload_Click(source As Object, e As EventArgs)
If Not (uploadedFile.PostedFile Is Nothing) Then
Try
Dim postedFile = uploadedFile.PostedFile
Dim filename As String = Path.GetFileName(postedFile.FileName)
Dim contentType As String = postedFile.ContentType
Dim contentLength As Integer = postedFile.ContentLength

postedFile.SaveAs(Server.MapPath("~") &amp;amp; "uploads/" &amp;amp; filename)

message.Text = postedFile.Filename &amp;amp; " uploaded" &amp;amp; _
"&amp;lt;br&amp;gt;content type: " &amp;amp; contentType &amp;amp; _
"&amp;lt;br&amp;gt;content length: " &amp;amp; contentLength.ToString()
Catch exc As Exception
message.Text = "Failed uploading file"
End Try
End If
End Sub
&amp;lt;/script&amp;gt;

&amp;lt;/head&amp;gt;
//&amp;lt;body&amp;gt;
//&amp;lt;form enctype="multipart/form-data" runat="server"&amp;gt; 
//Select ZIPPED Shapefile to Upload:&amp;nbsp; 
//&amp;lt;input id="uploadedFile" type="file" runat="server"&amp;gt; 
//&amp;lt;p&amp;gt; 
//&amp;lt;input type=button id="upload"&amp;nbsp; 
//value="Upload"
//OnServerClick="Upload_Click"
//runat="server"&amp;gt;
//&amp;lt;p&amp;gt; 
//&amp;lt;asp:Label id="message" runat="server"/&amp;gt; 
//&amp;lt;/form&amp;gt; 
//&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This successfully uploads the file to the server, but then i run into the problem of somehow telling my flex app that the file was uploaded successfully so I can continue with the flex code...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Apr 2012 15:17:13 GMT</pubDate>
    <dc:creator>MattGiles</dc:creator>
    <dc:date>2012-04-05T15:17:13Z</dc:date>
    <item>
      <title>uploading to server through flex</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/uploading-to-server-through-flex/m-p/521245#M11841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am writing a flex app that lets users upload a file to our server remotely. I use the fileReference.upload command to send the file to a server side script (.aspx) that will save it in an 'uploads' folder in the wwwroot on the server. I am having problems getting the server side script to work.. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have NO experience with .NET programming and found this script online:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;dim myFile as HttpPostedFile=Request.Files(0)
myFile.SaveAs(Server.MapPath("~") &amp;amp; "uploads/" &amp;amp; myFile.FileName)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can someone explain why this wont work with fileReference.upload()?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alternatively, I found this script (which includes a form):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;lt;%@ Import namespace="System.IO"%&amp;gt; 
&amp;lt;html&amp;gt; 
&amp;lt;head&amp;gt; 
&amp;lt;title&amp;gt;Uploading a File&amp;lt;/title&amp;gt;&amp;nbsp; 
&amp;lt;script language="VB" runat="server"&amp;gt;

Sub Upload_Click(source As Object, e As EventArgs)
If Not (uploadedFile.PostedFile Is Nothing) Then
Try
Dim postedFile = uploadedFile.PostedFile
Dim filename As String = Path.GetFileName(postedFile.FileName)
Dim contentType As String = postedFile.ContentType
Dim contentLength As Integer = postedFile.ContentLength

postedFile.SaveAs(Server.MapPath("~") &amp;amp; "uploads/" &amp;amp; filename)

message.Text = postedFile.Filename &amp;amp; " uploaded" &amp;amp; _
"&amp;lt;br&amp;gt;content type: " &amp;amp; contentType &amp;amp; _
"&amp;lt;br&amp;gt;content length: " &amp;amp; contentLength.ToString()
Catch exc As Exception
message.Text = "Failed uploading file"
End Try
End If
End Sub
&amp;lt;/script&amp;gt;

&amp;lt;/head&amp;gt;
//&amp;lt;body&amp;gt;
//&amp;lt;form enctype="multipart/form-data" runat="server"&amp;gt; 
//Select ZIPPED Shapefile to Upload:&amp;nbsp; 
//&amp;lt;input id="uploadedFile" type="file" runat="server"&amp;gt; 
//&amp;lt;p&amp;gt; 
//&amp;lt;input type=button id="upload"&amp;nbsp; 
//value="Upload"
//OnServerClick="Upload_Click"
//runat="server"&amp;gt;
//&amp;lt;p&amp;gt; 
//&amp;lt;asp:Label id="message" runat="server"/&amp;gt; 
//&amp;lt;/form&amp;gt; 
//&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This successfully uploads the file to the server, but then i run into the problem of somehow telling my flex app that the file was uploaded successfully so I can continue with the flex code...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 15:17:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/uploading-to-server-through-flex/m-p/521245#M11841</guid>
      <dc:creator>MattGiles</dc:creator>
      <dc:date>2012-04-05T15:17:13Z</dc:date>
    </item>
  </channel>
</rss>

