Forums

ASP

This topic is locked

how to have default value in pureaspupload

Posted 03 May 2002 15:48:29
1
has voted
03 May 2002 15:48:29 Darren Bennett posted:
anyone know how to put in a default value when using aspupload, this is so when I haven't got a picture for a record it automatically shows the default pic

Replies

Replied 08 May 2002 11:17:18
08 May 2002 11:17:18 johannes nel replied:
here i am not certain - i have had problem picking up the text from a pure asp-upload.
but,

i presume that you r storing the info in a db?
in that case just loop through the db and check where there r no entries in the db and insert your default....

Replied 08 May 2002 11:54:43
08 May 2002 11:54:43 Viktor Farcic replied:
You don't need to insert default value in DB. Just leave it blank if there's no picture. Later, on a page, check if that field is empty. Something like:
<% If (TableName.Fields.Item("FieldName".Value <> "" Then %>
Code to display image
<% Else %>
Code to display something instead of image
<% End If %>

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
anyone know how to put in a default value when using aspupload, this is so when I haven't got a picture for a record it automatically shows the default pic
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Viktor Farcic

TalkZone Manager
Replied 09 May 2002 12:35:17
09 May 2002 12:35:17 David Behan replied:
What I do here is set the default value in the database for the image field to "none.jpg". If they don't upload an image, this is the value in the database for the image field. There is no file called none.jpg so like vfaric said use that script to hide the image and display something else. Just use &lt;&gt; "none.jpg" instead of &lt;&gt; "".

The reason I do this is... basically I find it easier. You don't have to set the field to allow zero length strings, etc.

Regards,



_________________________
David Behan - www.bmor.com
Replied 09 May 2002 16:13:37
09 May 2002 16:13:37 Viktor Farcic replied:
You're right but that means that you're increasing DB size without any real reason. Bigger files = slower response/download.
Also, Access XP has "Allow Zero Lenght String" already set when new field is created.

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
What I do here is set the default value in the database for the image field to "none.jpg". If they don't upload an image, this is the value in the database for the image field. There is no file called none.jpg so like vfaric said use that script to hide the image and display something else. Just use &lt;&gt; "none.jpg" instead of &lt;&gt; "".

The reason I do this is... basically I find it easier. You don't have to set the field to allow zero length strings, etc.

Regards,



_________________________
David Behan - www.bmor.com
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Viktor Farcic

TalkZone Manager
Replied 09 May 2002 16:24:13
09 May 2002 16:24:13 David Behan replied:
As I said:

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>The reason I do this is... basically I find it easier. <hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

6 of 1 - half dozen of the other!


Regards

_________________________
David Behan - www.bmor.com
Replied 10 May 2002 00:20:37
10 May 2002 00:20:37 Darren Bennett replied:
Thanks everybody for your help,I used the code from vfarcic and it worked a treat.

Thanks very much
Replied 10 May 2002 12:35:13
10 May 2002 12:35:13 David Behan replied:
Ah well, you won this time. But next time... it will be I who is victorious. HA HA HA HA!!

LOL

_________________________
David Behan - www.bmor.com

Reply to this topic