• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 801
  • Last Modified:

php code in coldfusion

<?php

   if(!isset($_REQUEST['filename']))
   {
     exit('No file');
   }

   $upload_path = dirname(__FILE__). '/';
   
   $filename = $_REQUEST['filename'];
   
   $fp = fopen($upload_path."/".$filename.".wav", "wb");
   
   fwrite($fp, file_get_contents('php://input'));
   
   fclose($fp);
   
   exit('done');

?>
0
Gurpreet Singh Randhawa
Asked:
Gurpreet Singh Randhawa
  • 7
  • 7
1 Solution
 
RobOwner (Aidellio)Commented:
What exactly is your question.  your code looks ok?  you need the client side html?
0
 
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
read the question heading, i need the relevant code to be in [COLDFUSION], right now it is in php, how it will be written in Coldfusion
0
 
RobOwner (Aidellio)Commented:
This does the same as the php code above:
<cfif isDefined("fileUpload")>
  <cffile action="upload"
     fileField="fileUpload"
     destination="C:\docs">
     <p>Thankyou, your file has been uploaded.</p>
</cfif>
<form enctype="multipart/form-data" method="post">
<input type="file" name="fileUpload" /><br />
<input type="submit" value="Upload File" />
</form>

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
explain me this

fwrite($fp, file_get_contents('php://input'));

if that is relevant to the code for Colfusion
0
 
RobOwner (Aidellio)Commented:
The PHP opens the file, reads it in and writes it out again.  This isn't required.  The PHP should just copy the temporarily uploaded file to the required location.  That said the Coldfusion does this in the cffile tag
0
 
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
hmm, thanks for this to make me understand, i will keep this question open till i solve it and see php codes behave, honestly i do not know PHP and do not want to know PHP, i do not why :)
0
 
RobOwner (Aidellio)Commented:
let me know if there is any issues with the code i gave you.  we can work through it together :)
0
 
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
nopes not working it is not uploading the file
0
 
RobOwner (Aidellio)Commented:
See here for how to upload a file using coldfusion, which is all the PHP code you posted is doing:

http://www.dmxzone.com/go/2831/upload-files-with-coldfusion/
0
 
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
mite, i know how to upload a coldfusion file, i m not a  noob in CF, btw the PHP code if that is same, even it is still failing, i do not know
0
 
RobOwner (Aidellio)Commented:
interesting your php code is failing... your webserver needs permission to write files.  what is your webserver running windows / linux?
0
 
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
windows
0
 
RobOwner (Aidellio)Commented:
The PHP config file (php.ini) controls a lot of what goes on with uploads.  You need to check this out

do you have upload files enabled in the php.ini file?
What is maximum upload file size?

How big is the file you are trying to upload?

has this ever worked before?
0
 
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
i m accepting ur answer,

Reason is: PHP itcode Worked and i have not used Coldfusion so there was no need to use it

Thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 7
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now