|
I am using the asp:FileUpload to upload files as seen below but i want to save the target name as different name (GUID) with the same source extension? how can i do that?
string strFileName;
strFileName = myFile.FileName;
myFile.PostedFile.SaveAs(Server.MapPath(".") + "//galery//" + strFileName);
|
|
|
|
|
Just Append your file name wil GUID
System.Guid.NewGuid().
Step 1 : Get Only File Name
Step 2 : Get GUID using System.guid.NewGuid();
Step 3 : Get File Extention
Step 4 : Create File Name By (Steo1 + Step 2).step3
Step 5 : Save It
|
|
|
|
|
I am using the asp:FileUpload to upload files as seen below but i want how can i make sure the file was successfully uploaded?
string strFileName;
strFileName = myFile.FileName;
myFile.PostedFile.SaveAs(Server.MapPath(".") + "//galery//" + strFileName);
i thought of File.Exist but what if the file was partially uploaded due to some connection failure?
|
|
|
|
|
If it was only partially uploaded, if the upload process ended, do you think you'd get a postback in your page ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
well, can i ask you this question:
will not uploaded any part of the file to the web server until the postback in my page?
|
|
|
|
|
jrahma wrote: string strFileName;
strFileName = myFile.FileName;
myFile.PostedFile.SaveAs(Server.MapPath(".") + "//galery//" + strFileName);
string strFileName;
strFileName = myFile.FileName;
myFile.PostedFile.SaveAs(Server.MapPath(".") + "//galery//" + strFileName);
Response.Redirect("UploadSuccess.aspx"); Response.Redirect will be executed only after saving the file.
|
|
|
|
|
Is it possible to change the asp:UploadFile browse button text to anything in any language?
|
|
|
|
|
Yes.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
how?
i want it make it Righ-to-Left with the arabic translation of the word browse?
|
|
|
|
|
|
We converted the .Net 1.1 ver code to .Net 2.0 code and was working fine then we checkedin the code(Converter latest 2.0 ver ).After again downloading the .Net 2.0 code in build machine it's again prompts for conversion wizard. We compared each file by file there is no difference. We have no clue why again it's asking for conversion again
Any Ideas would be Appreciated.
Thanks In Advance
|
|
|
|
|
I've been using a purchased script that retrieves FedEx rates for about a year, and recently discovered that FedEx supplies some code samples to accomplish the same thing. The FedEx code takes an average of about 2 seconds to return rates, and the script (which uses an httpwebrequest and then reads through the xml response string) returns rates in less than half the time. I'm new to web services. Can someone explain the difference in performance and if there's anything to improve it?
Thanks.
|
|
|
|
|
How to get all the textbox fields get cleared with a for-each loop ?
|
|
|
|
|
set their text property to "" or string.empty
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
foreach (Control ctrl in this.Controls)<br />
{<br />
<br />
if (ctrl is TextBox) <br />
{<br />
ctrl.Text = "";<br />
}<br />
<br />
}
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
Hi Guyz
I have the following Database Tables
tbStaff
StaffID, Name, etc, etc, etc
1, Bob, ..., ..., ...,
2, Bill, ..., ..., ...,
3, John, ..., ..., ...,
4, Marry, ..., ..., ...,
tbStaffFigures
StaffID, Date, Value,
1, 01-01-08, 200,
2, 02-01-08, 100,
I want to dynamically create a GridView that looks like the following:
Date, Bob, Bill, John, Marry
01-01-08, 200, 100, Value, Value,
02-01-08, Value, Value, Value, Value,
etc, etc, etc, etc, etc,
|
|
|
|
|
I think I've seen this assignment before
Make a google search on "pivot OR crosstab sql" and the name of your database
|
|
|
|
|
HI ALL,
i'd calculator project in that i'm getting small error after getting the result (2+3=5)
the result value 5 is not deleting in text box, again it adding to new value given by user
can u help me
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace cal_sample
{
public partial class Form1 : Form
{
int r;
ArrayList a = new ArrayList();
public Form1()
{
InitializeComponent();
}
private void button_one_Click(object sender, EventArgs e)
{
//textBox1.Text = "";
textBox1.Text = textBox1.Text+button_one.Text;
}
private void button_two_Click(object sender, EventArgs e)
{
//textBox1.Text = "";
textBox1.Text = textBox1.Text + button_two.Text;
}
private void button_three_Click(object sender, EventArgs e)
{
//textBox1.Text = "";
textBox1.Text = textBox1.Text + button_three.Text;
}
private void button_four_Click(object sender, EventArgs e)
{
//textBox1.Text = "";
textBox1.Text = textBox1.Text + button_four.Text;
}
private void button_five_Click(object sender, EventArgs e)
{
// textBox1.Text = "";
textBox1.Text = textBox1.Text + button_five.Text;
}
private void button_six_Click(object sender, EventArgs e)
{
//textBox1.Text = "";
textBox1.Text = textBox1.Text + button_six.Text;
}
private void button_seven_Click(object sender, EventArgs e)
{
//textBox1.Text = "";
textBox1.Text = textBox1.Text + button_seven.Text;
}
private void button_eight_Click(object sender, EventArgs e)
{
//textBox1.Text = "";
textBox1.Text = textBox1.Text + button_eight.Text;
}
private void button_nine_Click(object sender, EventArgs e)
{
//textBox1.Text = "";
textBox1.Text = textBox1.Text + button_nine.Text;
}
private void plus_Click(object sender, EventArgs e)
{
if(textBox1.Text !="")
{
a.Add(Convert.ToSingle(textBox1.Text));
textBox1.Text = "";
}
else
textBox1.Text = Convert.ToString(0 + r);
}
private void equl_Click(object sender, EventArgs e)
{
r = 0;
for (int i = 0; i < a.Count; i++)
r = r + Convert.ToInt32(a[i]);
if (textBox1.Text != "")
{
textBox1.Text = Convert.ToString(r + Convert.ToInt32(textBox1.Text));
a.Clear();
}
else
textBox1.Text = Convert.ToString(r + 0);
}
private void button_clear_Click(object sender, EventArgs e)
{
textBox1.Clear();
}
private void button_zero_Click_1(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button_zero.Text;
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button_period_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + button_period.Text;
}
}
}
[code][/code]
madhu
|
|
|
|
|
madhu Rao wrote: textBox1.Text = Convert.ToString(r + Convert.ToInt32(textBox1.Text));
is the problem i believe, also you allow them to use decimals but convert everything to INT, which i fairly certain wont work, unless integer means something else in your computer. also every button click runs a += line, so unless the answer to the previous problem is cleared, it will always use that answer ..as the first number in the next set. so if you do 2 + 3 = and get 5 then try to do 4 + 3 you end up with 54 + 3. unless i misread something.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
This is not the Right forum for your Question !!! Post it to C# Forum
|
|
|
|
|
i am working webparts ..Its working successfully but cannot published...
the following error will be displayed
Error 1 The process cannot access the file 'C:\Documents and Settings\Afxisi\Desktop\webparts\UserControlEditorPartEx\App_Data\ASPNETDB.MDF' because it is being used by another process. /
|
|
|
|
|
Are you getting the error while publishing the website from Visual Studio ?
|
|
|
|
|
Try,
at the time of publishing,the application should not in running state
Cheers!!
Brij
|
|
|
|
|
You can't Publish your web application if its on running mode. you have to stop debugging !!!!
|
|
|
|
|
Hi to all,
I am new to ASP.net and i want to execute some code after textbox's lostfocus event in ASP.Net. I tried by using its TextChanged event but it takes more time to execute it because it executes on server, i want to execute this code on client machine only. how can i do this?
Help me.
Thanks.
Pravin
|
|
|
|
|