close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

File Manipulation Uploads in UE

Thread began 2/01/2012 6:05 am by gary.brett434358 | Last modified 2/02/2012 7:30 am by gary.brett434358 | 1874 views | 8 replies |

gary.brett434358

File Manipulation Uploads in UE

Hi, using Dynamic Suite I wanted to add a file upload to both my insert & update pages. Do I need to store images in a db table? Currently I have tblcases that stores new cases, at the end of the insert/update pages I want to add the upload feature. Do I need to create another table and link it to tblcases by CaseID to store all documents?

So far I have added the upload behaviour to an insert form in testing but the file never uploads, I note the path becomes c:\fakepath\filename.txt after selecting the file, using IE & Chrome?

Code inserted by DA:

<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "CaseDocuments/",
'FileName' => "[FileName]_[Increment]",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if($_SERVER["REQUEST_METHOD"] == "POST"){
WA_DFP_UploadFiles("WA_UploadResult1", "doc_upload", "0", "", "false", $WA_UploadResult1_Params);
}
?>



Not sure if I actually have DFP or not, I can only get this wizard through Insert | WebAssist | File Manipulation | Upload

Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

the file manipulation behaviors are the same as the DFP behaviors.

the uploaded files will be stored on the server, you should be storing the uploaded file name in the database.

"Do I need to create another table and link it to tblcases by CaseID to store all documents?"

yes, if you are creating a one to many relationship (one case to many documents) the file names should be stored in a separate table.


send a copy of the insert page so i can examine the full page code to determine why the upload is failing.

Sign in to reply to this post

gary.brett434358

Hi Jason,
I hadn't included any database tables or fields just followed the tutorials on basic usage.

I have attached the basic insert page which i just wanted to have docs stored in '/CaseDocuments' folder with 'CaseID+ContactID+Increment' as filename. Woudl I use session values for that?

Are there any details tutorials explaining it all?

Cheers

Attached Files
tblcases_Insert_Direct.zip
Sign in to reply to this post

Jason ByrnesWebAssist

first, for the upload to work, the form encoding type needs to be changed:
change:

php:
<form method="POST" name="WADAInsertForm" id="WADAInsertForm" class="mainForm">



to:

php:
<form method="POST" enctype="multipart/form-data" name="WADAInsertForm" class="mainForm" id="WADAInsertForm">




as for using the client and case id in the uploaded filer name, this will be tricky.

first, the file upload code will need to come after the insert record code.

the case ID will come from the tblcases_CaseID session created by the insert behavior, it looks like you have a form element for the contact, so you will need to use that binding. This is not a supported feature and will take some custom coding.

Sign in to reply to this post

gary.brett434358

Hi Jason, what are the normal naming procedures with DFP, does it simply upload the file with the original image name as standard?

I need to try and understand how I can 'bind' any uploads with their relevant cases, if its not supported no worries. I just thought I could append a session value such as CaseID onto originalfilename [001_samplefile.pdf]. Only the case owner would then see the documents.

Thanks again.

Sign in to reply to this post

Jason ByrnesWebAssist

binding the case ID to the file name would not make it so only the case owner could see it.

for that to work, you would store the file name as is, into a new table and also store the case owners ID.


you could then create a recordset to show all case files and filter it on the logged in users session to return the files for that user.

Sign in to reply to this post

gary.brett434358

Sorry Jason, may have confused things a touch. What I meant was if the upload is linked to the CaseID then each time the case owner viewed or updated the case they would have access to any uploaded files relating to that case.

Am I correct in creating a new recordset based on tblUploads, then during DFP wizard choosing this recordset and filename field for the destination folder? I guess not as that doesnt upload any filename to the table, if I select an actual folder it does upload but then how do I insert filename & CaseID into the table to link?

<?php echo $row_rsFileUpload['FileName']; ?>



Are there any WA helpfiles on methods to us DFP to insert files to tables, the wizard seems to only make a standard upload from what I can see. I hate to keep bothering you but have no guidance on how the extensions operate except using the forums.

Sign in to reply to this post

Jason ByrnesWebAssist

the problem here is that you are trying to figure out 2 things at the same time:
1) how to create a relational database for your needs

2) how to use data assist to manage that database.

and you are approaching the problem from the data assist angle first, that's kind of putting the cart before the horse. you need to figure out your database structure first, before you begin trying to create the pages with data assist. If you don't figure how the database is going to work, it's going to make figuring out data assist impossible.

so, you have cases and files for those cases. you will need to use 2 tables for this



cases:
caseID - primary key
casename
etc...

caseFiles
caseFileID - primary key
caseFileCaseID - relates to cases.caseID
caseFileFileName - gets the name of the uploaded file

your insert form should insert the case data to the case table, then in another insert behavior, it can insert the case ID using the session that is created from the first insert to the files table and use the Server File Name binding from the WA Uploaded Files binding group to insert the file name to the files table.

Sign in to reply to this post

gary.brett434358

Originally Said By: Jason Byrnes
  your insert form should insert the case data to the case table, then in another insert behavior, it can insert the case ID using the session that is created from the first insert to the files table and use the Server File Name binding from the WA Uploaded Files binding group to insert the file name to the files table.  



Hi Jason, yes I managed to finally work it out early this morning by playing around. What threw me was DFP doesn't create the insert behaviour, its little things like that which keep me on one page for days!

Now I need to work out how to retrieve the doc in the detail pages, another head scratcher for me I am sure!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...