CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 File Upload and PHP for Store Example

Print topic Send  topic

Author Message
wizy

Posts: 40
Posted: 05/22/2006, 12:42 PM

Need help on this one:
http://forums.codecharge.com/posts.php?post_id=74786

1) how do I stop appending the time/date to the filename on upload. I do not want that to happen. IT is not needed, contrary to what peterr posted. The reason why I dont want the time/date appended is for my reasons only.

2) how do you get the upload to write to the database? I dont see how it does it. I assigned the field with the name of the database field and when I uploaded, the field was filled with "NULL".
View profile  Send private message
Damian Hupfeld
Posted: 05/23/2006, 4:54 AM

wizy,

1. your reasons or not, the date and time will always be appended if you use
the included file upload component. you can always write your own if you
have specific requirements. the posts you refer to as well as the following:

http://forums.codecharge.com/posts.php?post_id=51846

suggest how you may be able to do it using the existing tools.

2. did you follow the instructions? I dont "see how" a lot of things in CCS
work but they generally do if set up properly - thats one of the nice things
about a RAD tool - it does the "how" for you.

Things to try - check your DB field data type - if it is not some sort of
text field it will probably record NULL. It might also record NULL if it is
not long enough???? Maybe? Also sometimes a page/grid gets broken. Try
recreating the page.

Damian


"wizy" <wizy@forum.codecharge> wrote in message
news:54472141f70ea6@news.codecharge.com...
> Need help on this one:
> http://forums.codecharge.com/posts.php?post_id=74786
>
> 1) how do I stop appending the time/date to the filename on upload. I do
> not
> want that to happen. IT is not needed, contrary to what peterr posted. The
> reason why I dont want the time/date appended is for my reasons only.
>
> 2) how do you get the upload to write to the database? I dont see how it
> does
> it. I assigned the field with the name of the database field and when I
> uploaded, the field was filled with "NULL".
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

WKempees
Posted: 05/23/2006, 7:28 AM

Further to Damian, and
check the setting for your upload and temp directories.
existence and rights.

"Damian Hupfeld" <damian.hupfeld@itng.com.au> schreef in bericht
news:e4ut67$f6b$1@news.codecharge.com...
> wizy,
>
> 1. your reasons or not, the date and time will always be appended if you
> use the included file upload component. you can always write your own if
> you have specific requirements. the posts you refer to as well as the
> following:
>
> http://forums.codecharge.com/posts.php?post_id=51846
>
> suggest how you may be able to do it using the existing tools.
>
> 2. did you follow the instructions? I dont "see how" a lot of things in
> CCS work but they generally do if set up properly - thats one of the nice
> things about a RAD tool - it does the "how" for you.
>
> Things to try - check your DB field data type - if it is not some sort of
> text field it will probably record NULL. It might also record NULL if it
> is not long enough???? Maybe? Also sometimes a page/grid gets broken. Try
> recreating the page.
>
> Damian
>
>
> "wizy" <wizy@forum.codecharge> wrote in message
>news:54472141f70ea6@news.codecharge.com...
>> Need help on this one:
>> http://forums.codecharge.com/posts.php?post_id=74786
>>
>> 1) how do I stop appending the time/date to the filename on upload. I do
>> not
>> want that to happen. IT is not needed, contrary to what peterr posted.
>> The
>> reason why I dont want the time/date appended is for my reasons only.
>>
>> 2) how do you get the upload to write to the database? I dont see how it
>> does
>> it. I assigned the field with the name of the database field and when I
>> uploaded, the field was filled with "NULL".
>> ---------------------------------------
>> Sent from YesSoftware forum
>> http://forums.codecharge.com/
>>
>
>

wizy

Posts: 40
Posted: 05/23/2006, 2:21 PM

Quote Damian Hupfeld:
wizy,

1. your reasons or not, the date and time will always be appended if you use
the included file upload component. you can always write your own if you
have specific requirements. the posts you refer to as well as the following:

http://forums.codecharge.com/posts.php?post_id=51846[/quote]

What do I change in the "last" suggestion:
$ActualFileName = date("YmdHis") . $index . "." . $FileName;


Quote :
2. did you follow the instructions? I dont "see how" a lot of things in CCS
work but they generally do if set up properly - thats one of the nice things
about a RAD tool - it does the "how" for you.

Yup followed it to the T. the db field is set to 255 characters, so its long enough
View profile  Send private message
Damian Hupfeld
Posted: 05/23/2006, 2:41 PM

Wizy,

I dont know the answer to Q1. If you cant modift CCS inbuilt functions to do
what you want you shoudl write your own.
There are plenty of resouces on the net -
http://www.google.com/search?q=php+file+upload

I have never had a file-upload not work and its not something I have noticed
mentioned in this forum.... so its probably something on your end. Possibly
in playing with the Common files or in your efforts to get this to work how
you want it you may have broken something. Try creating a new page with
application builder and add a file-upload component and if that doesnt work
try creating a whole new project because some of your common files could be
damaged.

Damian



"wizy" <wizy@forum.codecharge> wrote in message
news:544737ced58ef1@news.codecharge.com...
>
Quote Damian Hupfeld:
> wizy,
>
> 1. your reasons or not, the date and time will always be appended if you
> use
> the included file upload component. you can always write your own if you
> have specific requirements. the posts you refer to as well as the
> following:
>
> http://forums.codecharge.com/posts.php?post_id=51846[/quote]
>
> What do I change in the "last" suggestion:
> $ActualFileName = date("YmdHis") . $index . "." . $FileName;
>
>
>
Quote :
2. did you follow the instructions? I dont "see how" a lot of
> things in
> CCS
> work but they generally do if set up properly - thats one of the nice
> things
> about a RAD tool - it does the "how" for you.
>
> Yup followed it to the T. the db field is set to 255 characters, so its
> long
> enough
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

wizy

Posts: 40
Posted: 05/26/2006, 5:00 PM

Quote Damian Hupfeld:
Wizy,

I dont know the answer to Q1. If you cant modift CCS inbuilt functions to do
what you want you shoudl write your own.

If i could, I wouldn't be using code charge, now would i?

Quote :
I have never had a file-upload not work and its not something I have noticed
mentioned in this forum.... so its probably something on your end.
Dont know what it could be since, i followed the directions. named the directory in the properties and the DB field is from the SAMPLE mysql data that came with the program. I didn't touch anything else.


Quote :
Possibly
in playing with the Common files or in your efforts to get this to work how
you want it you may have broken something. Try creating a new page with
application builder and add a file-upload component and if that doesnt work
try creating a whole new project because some of your common files could be
damaged.

I haven't touched ANYTHING. or modded anything.

still need an answer to Question 1.
View profile  Send private message
Damian Hupfeld
Posted: 05/26/2006, 9:39 PM

Wizy,

I dont know if asking your question 4 times will get you the answer you are
looking for. 3 times hasnt but maybe a 4th will? Good luck.

Damian



"wizy" <wizy@forum.codecharge> wrote in message
news:5447796985fb7d@news.codecharge.com...
>
Quote Damian Hupfeld:
> Wizy,
>
> I dont know the answer to Q1. If you cant modift CCS inbuilt functions to
> do
> what you want you shoudl write your own.
>
> If i could, I wouldn't be using code charge, now would i?
>
>
Quote :
I have never had a file-upload not work and its not something I
> have
> noticed
> mentioned in this forum.... so its probably something on your end.
> Dont know what it could be since, i followed the directions. named the
> directory in the properties and the DB field is from the SAMPLE mysql data
> that
> came with the program. I didn't touch anything else.
>
>
>
Quote :
Possibly
> in playing with the Common files or in your efforts to get this to work
> how
> you want it you may have broken something. Try creating a new page with
> application builder and add a file-upload component and if that doesnt
> work
> try creating a whole new project because some of your common files could
> be
> damaged.
>
>
> I haven't touched ANYTHING. or modded anything.
>
> still need an answer to Question 1.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

wizy

Posts: 40
Posted: 05/29/2006, 10:56 PM

What do I change in this line to elimnate the adding of the time/date to the filename?
$ActualFileName = date("YmdHis") . $index . "." . $FileName;

View profile  Send private message
wizy

Posts: 40
Posted: 05/30/2006, 2:57 PM

^^ bump
View profile  Send private message
wizy

Posts: 40
Posted: 06/01/2006, 5:06 PM

still waiting for an answer to this:

What do I change in this line to eliminate the adding of the time/date to the filename?
$ActualFileName = date("YmdHis") . $index . "." . $FileName;
View profile  Send private message
wizy

Posts: 40
Posted: 06/02/2006, 1:01 PM

still waiting for an answer to this:

What do I change in this line to eliminate the adding of the time/date to the filename?
$ActualFileName = date("YmdHis") . $index . "." . $FileName;
View profile  Send private message
peterr


Posts: 5971
Posted: 06/02/2006, 2:20 PM

Me too, but there is no need to repeat the same question. Probably no one has a solution for you or doesn't want to share it with you, or doesn't have time. It's your chance to be helpful, figure it out and post the solution for others.
BTW, it looks to me like you're just too lazy, and only demand from others to do the work for you. If you spent a few minutes with this code you might've already gotten it to work.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
WKempees
Posted: 06/02/2006, 4:38 PM

hint: $ActualFileName = $FileName;

wkempees


Posts: 1679
Posted: 06/02/2006, 4:55 PM

Also
If you leave the upload as it is (including datestamp+index+actualfilename)
Then in the form or Grid you want to diplay uploaded files you may want to use the ServerSideAction Get Original Filename
Quote :

Get Original Filename
Use this action to get the original filename of the uploaded file (i.e. without the prefix that is added to ensure that the file name is unique). This action can be used to display the original file name to the user.

The action can be used only in the Before Show event of the Label and Link controls.

Walter, my last contribution to this topic

_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
wizy

Posts: 40
Posted: 06/02/2006, 5:43 PM

Quote WKempees:
hint: $ActualFileName = $FileName;




can we just eliminate the entire line instead? Since it looks like its being redundant
View profile  Send private message
wizy

Posts: 40
Posted: 06/02/2006, 5:44 PM

Quote peterr:
t's your chance to be helpful, figure it out and post the solution for others.

If I knew how to code, i wouldn't be asking for a solution.

Quote :
BTW, it looks to me like you're just too lazy, and only demand from others to do the work for you. If you spent a few minutes with this code you might've already gotten it to work.

If I knew how to code, I wouldn't be asking for a solution.
How can I find a solution/edit code if I dont know what the code does?

Seriously, isn't this supposed to be help forums?
View profile  Send private message
wizy

Posts: 40
Posted: 06/02/2006, 5:48 PM

Quote wkempees:
Also
If you leave the upload as it is (including datestamp+index+actualfilename)
Then in the form or Grid you want to diplay uploaded files you may want to use the ServerSideAction Get Original Filename
Quote :

Get Original Filename
Use this action to get the original filename of the uploaded file (i.e. without the prefix that is added to ensure that the file name is unique). This action can be used to display the original file name to the user.

The action can be used only in the Before Show event of the Label and Link controls.

Walter, my last contribution to this topic



thanks on that, but I just dont like filenames being that long in the first place. the less characters for a file name, the less amount of bytes it takes up in your database, so on and so forth.
View profile  Send private message
peterr


Posts: 5971
Posted: 06/04/2006, 1:24 PM

Quote wizy:
If I knew how to code, I wouldn't be asking for a solution.
How can I find a solution/edit code if I dont know what the code does?
OK, although I saw that you previously wrote that you modified the old CodeCharge to store templates in a database, therefore I assumed that you do some PHP coding. Actually I also don't do coding, but I am figuring a lot of things out by looking at the code or testing and modifying solutions that I find. The above coding tip was also found on the forums and finalizing it should require only a little testing, which is not a responsibility of anyone unless someone wants to spend their time on this for you.

Quote wizy:
Seriously, isn't this supposed to be help forums?
The forums are what everyone here makes them. If someone helps you and you help others than they will be help forums, but if you annoy the hell out of everyone then I'm not sure what they will be. :*)
Also see the note below in the footer: "These are Community Forums for users to exchange information. If you would like to obtain technical product help please visit http://support.yessoftware.com ."
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
wizy

Posts: 40
Posted: 06/05/2006, 2:18 AM

Quote peterr:
OK, although I saw that you previously wrote that you modified the old CodeCharge to store templates in a database, therefore I assumed that you do some PHP coding.
I asked in these forums how to do so for the old CC and got an answer. Specifically the code so I didn't have figure it out.

Quote :
Actually I also don't do coding, but I am figuring a lot of things out by looking at the code or testing and modifying solutions that I find.
Well good for you. But for someone who doesn't know what is what, its not going to help me to play around with code if I dont know what it exactly does.


Quote :
The above coding tip was also found on the forums and finalizing it sould require only a little testing, which is not a responsibility of anyone unless someone wants to spend their time on this for you.
Though, yet people give out specific code and modifcations on this forum. why not now?
View profile  Send private message
Benjamin Krajmalnik
Posted: 06/07/2006, 9:42 AM

Wizy,

Time to put on the thinking cap, since you have already pointed to the
solution yourself.
I have already done this for our website, where I do not want timestamped
files, so here is the code and an explanation of what is going on.
However, I recommend you get yourself a good PHP tutorial and learn. I see
you are at least looking in the right places, so that is good.

Below is my modified code:


  
        // move uploaded file to temporary folder  
        $file_exists = true;  
        $index = 0;  
//        while($file_exists) {  
//          $ActualFileName = date("YmdHis") . $index . "." . $FileName;  
    $ActualFileName = $FileName;  
//          $file_exists = file_exists($ActualFileName);  
//          $index++;  
//        }  
        if( copy($_FILES[$FileControl]["tmp_name"], $this->TemporaryFolder .   
$ActualFileName) ) {  
          $this->Value = $ActualFileName;  
          $this->Text = $ActualFileName;  

You see how easy this was? The answer was in front of you all the time.
Look at the lines which I commented out.
What they are doing is making sure that any file uploaded is unique, to
avoid it being overwritten.
That way, if you delete a file associated with a specific record (with the
same origina basename), when it is referenced by another record it will
strill be there.

SO, this change has huge potential problems. In my case, since I am
uploading distcint imacges for each record, I do not run the risk of this
happening.

back to the annotation.

A flag ($file_exists) is set to true. This will be used in the while loop.
YOu notice 2 parts are ised in creating the prefix. The date, and an index.
Why, you say? Well, let's assume the od chance that 2 people upload the
same file at the exact same time. If only the timestamp was used, one would
be lost. Therefotre the index.

Now, you notice I simply commented out the whilr loop, and made a direct
assignment.

There is another part of the puzzle which needed to be checked out. You
notice this class also has a functio called GetFileName.
When making the changes I needed to make sure that this function (which
converts the actial file name to one with a stripped prefix for the end
user) would still work properly.
No changes were required, but it had to be checked to make sure it would not
brek something else.

BUT,. remember, if two records point to the same file, and you delete one of
the records (or the image in one of the records), it will be gone from both.


Benjamin Krajmalnik
Posted: 06/07/2006, 9:48 AM

No, since the $ActualFileName is the one being used in the class as the
value to store in the database.

Benjamin Krajmalnik
Posted: 06/07/2006, 9:53 AM

> If I knew how to code, i wouldn't be asking for a solution.

If you don't know, and don't wan to learn how to code, maybe you are in the
wrong business?

> If I knew how to code, I wouldn't be asking for a solution. You guys trout
> the
> software for non-coders to use...remember that.
>

OK. Let's see. Can you take some sort of database definition (however
convoluted it may be), and wizzard an application with Codecharge to
maintain those tables without having to write a single line of code? The
answer is yes. Is the UI going to be the best? Probably not. Bells and
whistles? Well, out of the box you have built-in sorters, paging, searches,
forms, calendars? Well, looks to me like they have achieved the goals.

I can buy you the most expensive paints and canavas. That would not make
you a DaVinci.

CodeCharge provides you with a workable framework on which to expand. To
expand it, well, you need to learn how to code. If not, don;t write
applications.

peterr


Posts: 5971
Posted: 06/07/2006, 12:22 PM

Hi Ben,
Looks like we've run into a Forum limitation - Wizzy modified part of his previous answer right after posting, but the corresponding NNTP/Newsgroup post wasn't changed.
And maybe let's stop beating a dead horse (topic) anyway? :-)
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.