, Guest!
Already a Member? Login or Register.

Menu



Showcase


Due to the volume of spam happening on our forums, posting is now restricted to verified members only.  If you're not verified, drop us a note with your username.

Home > FlexCMS Support Forum > User Help > General Support Requests > How can I upload user file?

FlexCMS Support Forum


How can I upload user file?
Started April 28, 2005 @ 3:59pm by jacmgr
Post Message 
jacmgr


Posts: 18
 
How can I upload user file?April 28, 2005 @ 3:59pm
I have a text file that I want one of my pages to access. I may need to change this text file from time to time and re-upload it. I'd like to be able to do this from within FLEX. So I figure that:
1) I make a new page and put php code in to it that diplays a form and file upload form field.
2) When you press upload formfield the PHP code stores that file and overwrites an existing file with same name. (say in the uploaded files directory - predetermined directory and specified in the code snippet)
3) My php code on another pages can read/include that text file and do what it needs to do (which is not display oriented..this is a data file)
----------------------------------
Do you have any pre-made snippets to do the upload and save? If not no problem!

Thankx again for all your help Smile !
John
 
DCSun
Administrator



Posts: 625
 
April 28, 2005 @ 4:34pm
Hi John

We do have some file upload features planned for our next version, including the ability to offer downloads on your site.

In the meantime, however, here's a couple pieces of code that should accomplish what you're after.


Page 1 (PHP Enabled):

Code

print '<form name="UploadForm" action="'.$MainURL.'/pages/upload2" method="post" enctype="multipart/form-data">

<input type="file" name="FileData">

<br><br>

<input type="submit" value="Upload File">

<input type="hidden" name="MAX_FILE_SIZE" value="500000">

</form>';


Page 2 (PHP Enabled, Named "upload2"):

Code

$FileData = $_FILES['FileData']['tmp_name'];

$DestinationPath = './images/uploaded/';
$NewFilename = $_FILES['FileData']['name'];

move_uploaded_file($FileData, $DestinationPath.$NewFilename);



That should at least get you to the party. That's a fairly insecure way of doing things, but if you're running it in restricted pages and only giving access to those you trust you'll be fine.


David


FlexCMS v3.2 Has Been Released!
 

Last Edit: August 15, 2005 @ 6:04pm by DCSun
jacmgr


Posts: 18
 
April 28, 2005 @ 6:10pm
That's great! Only the manager of the board will access this, so should be OK as far as security goes!

You guys are great!
Thankx
John
 

Post Message 




Try & Buy FeedForAll - Easy to use RSS Feed Creator - great for iTunes users!

MEMBERS




All Contents, Code, Scripts and Technologies Copyright 2003-2009 FlexCMS.
All Rights Reserved. Software License Agreement

Processing Time: 0.13848 seconds.
 
Management Login

Powered By FlexCMS
Powered By FlexCMS