Link to home
Start Free TrialLog in
Avatar of kalvillo
kalvillo

asked on

Transition from PHP to ASP.net

Hi.

I'm starting to code in ASP.NET, and i have the following question.

I want to code a program to upload a file using "actionscript 2.0" ( flash.net.FileReference) on VB.NET; right now, i know how to do this using Perl and PHP ( "move_uploaded_file($_FILES['Filedata']['tmp_name'], "./imgage_files/".$_FILES['Filedata']['name'])"),
but i can't find how to accomplish the same task using this language.

I hope you could help me, and thank you very much.
Avatar of tzuhsun
tzuhsun
Flag of Malaysia image

Hi i can't give you a quick answer as I no idea right now.

But you can try search in goole by uing such phrase:
"ASP.net equivalient to move_uploaded_file()"

most of the time would not disappoint you.
ASKER CERTIFIED SOLUTION
Avatar of niralshah
niralshah
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kalvillo
kalvillo

ASKER

niralshah> that's not exactly what i'm looking for...

Right now, i have the following Flash code to "browse" my files:

import flash.net.FileReference;

_root.http_file = "http://myDom.com/upload.php";

// start exploration
btnListener.click = function(eventObj:Object) {
	var fileRef:FileReference = new FileReference();
	fileRef.addListener(fileListener);
	fileRef.browse(fileTypes);
}

//send file selected
fileListener.onSelect = function(file:FileReference):Void {
   resultsTxtField.text += "File Selected: " + file.name;
   if(!file.upload(_root.http_file)) {
       resultsTxtField.text += "Upload dialog failed to open.\n";
   }
}

Open in new window


When you select the desired file in the dialog box, Flash sends the file to the following code in PHP:

<?php
	move_uploaded_file($_FILES['Filedata']['tmp_name'], "./file_images/".$_FILES['Filedata']['name']);
	chmod("./file_images/".$_FILES['Filedata']['name'], 0777);
?>

Open in new window


This PHP code delivers the file into the server.

What i need is a code in ASP.NET that do the same thing than the PHP one... i mean, the Flash code works fine as it is, i just need a code in ASP to conect with such flash code.
niralshah> by the way.. that code that you send me, do you have it on "Action Script 2"?... it could be handy for another process.