|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Import files to UNIX folder
i want to ask...how can i write the code in coldfusion to import all the files such as .pdf, .doc, .tiff etc in my computer (which is i'm using windows XP ) to the folder in UNIX?
|
|
#2
|
|||
|
|||
|
When you say "import" do you really just mean "copy"? If so, yes you can do this with cffile and cfdirectory. Just read the contents of your Windows folder, loop over it, and copy the files with the desired extensions to the UNIX folder. Of course this assumes that the UNIX box has a publically shared folder that CF can access to copy the files.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
sorry to disturb u again...this is the cf statement that i already done if i copy the files from NT server to NT server..
<cffile action="upload" destination="F:\TMDOCMALL\Devl\EdmsDoc\" nameConflict="makeUnique" fileField="Form.UploadFile"> ...but if I want to copy files in NT server to folder in UNIX server, it cannot be done like that...i have to put something at the dot line at the first statement like below:- <cffile .......... action="upload" destination="F:\TMDOCMALL\Devl\EdmsDoc\" nameConflict="makeUnique" fileField="Form.UploadFile"> so what statement should i put at the dot line?thank you |
|
#4
|
|||
|
|||
|
Have you read the documentation on cffile?
http://livedocs.macromedia.com/cold...7.htm#wp1098395 cffile action="upload" is used for uploading files from a user's web browser to the CF server, using a form field of type "file". What you are asking for does not sound like that. It sounds like you'll want to use cfdirectory to read in a directory of files, and the loop over that result set and use cffile to copy the files to a share on another server. |
|
#5
|
|||
|
|||
|
i'm quite confuse now...let me explain a little bit of my problem...before this i keep all the file and database in NT server..this server have coldfusion application....now i want to copy all the files in NT server to the folder in UNIX server....but in UNIX server there is no coldfusion application installed....do i need to use cfftp?and how was that?i have no idea to solve this problem...thank you for ur help
|
|
#6
|
|||
|
|||
|
Well you're not really explaining this very clearly. So you just want to MANUALLY copy your .cfm files over to a UNIX server? Are you going to do this yourself or do you want ColdFusion itself to do it? And what is the point of copying the .cfm files over to the UNIX box if the UNIX box doesn't have ColdFusion installed on it? Is this just for backups?
The bottom line is that if you want to copy a file from one place to another using ColdFusion itself, you use CFFILE. CFFTP would only work if the UNIX box had an FTP server set up for you to transfer files to. |
|
#7
|
|||
|
|||
|
i want coldfusion to do it for me.....i don't want to do by manually....what i really want to do is to copy all the .cfm files in NT server which is already have coldfusion to UNIX box that don't have coldfusion...i have use cffile but it does not work....all the .cfm files did not copied to the folder in UNIX box....what i want is when i upload any files through the form in the add_document_form.cfm, all the files will be copied to folder in UNIX box.....so what should i do? if i have to use ftp,where should i install ftp?it is in NT server or UNIX box? thank you..
|
|
#8
|
|||
|
|||
|
If all the .cfm files did not get copied from the NT box to the UNIX box, then your code is incorrect. You aren't properly using cfdirectory to read all the files and move them over.
If you want to use FTP then you'll have to put an FTP server on the UNIX box. But the same problem will remain...if you aren't feeding all the .cfm files to your cffile calls then you won't be feeding all the .cfm files to your cfftp calls either. |
|
#9
|
|||
|
|||
|
what i do now is using cfftp....i want to upload the files through the form into the folder that exist in UNIX box...so can u give me the example code to putfile to the folder in UNIX?...the name of the folder in UNIX is /dev/vghds01/edms02....while all the .cfm files that will be uploaded is from any directory in my pc...so how can i write the code?
|
|
#10
|
|||
|
|||
|
i use this but the file is not uploaded...i check using telnet to check in UNIX folder but nothing happen?how can i fix it?
<cfftp action="open" server = "*********" username = "******" password = "******" stoponerror= "No" connection = "UploadConnection"> <p>Did it succeed? <cfoutput>#cfftp.succeeded#</cfoutput> <cfftp action = "LISTDIR" stopOnError = "Yes" name = "RemoteDirList" directory = "/dev/vghds01/edms02" connection = "UploadConnection"> <cfftp action="PutFile" connection="UploadConnection" transfermode="binary" remotefile="#GetFileFromPath(form.UploadFile)#" localfile="#form.UploadFile#"> <!--- close the connection ---> <cfftp action="CLOSE" connection="UploadConnection"> |
|
#11
|
|||
|
|||
|
this is the latest code that i've done...but it is still not uploaded to my UNIX folder....here is the code:-
<P>Open a connection <cfftp connection = "UploadConnection" username = "******" password = "********" server = "********" action = "open" timeout="15000" directory = "/dev/vghds01/edms02" stopOnError = "Yes"> <P>Did the connection succeed? <cfoutput>#cfftp.succeeded#</cfoutput> <P>Upload File . <cfftp connection = "UploadConnection" action = "putFile" name = "uploadFile" transferMode = "Auto" stopOnError = "Yes" timeout="15000" remotefile="/dev/vghds01/edms02/#form.UploadFile#" localfile="#form.UploadFile#"> <p>Did the Upload succeed? <cfoutput>#cfftp.succeeded#</cfoutput> <cfftp connection = "UploadConnection" action = "LISTDIR" stopOnError = "Yes" name = "ListDirs" directory = "/dev/vghds01/edms02"> <P>FTP Directory Listing:<BR> <cftable query = "ListDirs" HTMLTable = "Yes" colHeaders = "Yes"> <cfcol header = "<B>Name</B>" text = "#name#"> <cfcol header = "<B>Path</B>" text = "#path#"> <cfcol header = "<B>URL</B>" text = "#url#"> <cfcol header = "<B>Length</B>" text = "#length#"> <cfcol header = "<B>LastModified</B>" text = "#DateFormat(lastmodified,"MM/DD/YYYY")#"> <cfcol header = "<B>IsDirectory</B>" text = "#isdirectory#"> </cftable> <P>Close the connection: <cfftp connection = "UploadConnection" action = "close" stopOnError = "Yes"> <P>Did the connection close? <cfoutput>#cfftp.succeeded#</cfoutput> for your information, my folder in UNIX is /dev/vghds01/edms01/.....while the files that i want to upload will get from the form which is #form.UploadFile# in add_document_form.cfm....what i want to do is when i browse file in the form to upload, that files will be automatically go to the folder in UNIX to be keep...i have ftp in my UNIX box and NT server as well....so what is the problem with my code? |
|
#12
|
|||
|
|||
|
Can you use a normal FTP client to put the file to the UNIX box yourself? Did you actually install an FTP server on the UNIX box?
|
|
#13
|
|||
|
|||
|
ftp already install to UNIX box....my boss just want the transfering be done using coldfusion...i have to use cfftp....is it my code got problem?can u see my code up there?can u detect the problem?
|
|
#14
|
|||
|
|||
|
First, can you manually transfer a file to the UNIX box yourself using an FTP program?
I don't notice anything obviously wrong with the code but since I can't test it that doesn't mean very much. |
|
#15
|
|||
|
|||
|
ok..let we start over again....actually i'm not sure whether i have to use cfftp or not...i have two server, one is NT and another one is UNIX....there is coldfusion server in NT but in UNIX there is no coldfusion server....but both of them have ftp.....what i'm gonna do now is to transfer all .cfm files from NT server to UNIX box...i have to transfer all .cfm files using coldfusion....it mean when i upload files through form, that files will automatically transfer to folder in UNIX....so for ur suggestion, what should i do?do i have to use cfftp or ffile?or do i have any choices either than that?but i must use coldfusion to do this to me....
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Import files to UNIX folder |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|