Sunil K Bansal

Ranch Hand
+ Follow
since Jan 04, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sunil K Bansal

Hi Guys,
I want to upload a file to server...
i m using <input type=file...
and ENCTYPE=multipart/form-data in the form tag..
but i m not able to upload..
kindly also tell me if there is any limit on file size to upload via from tag. ENCTYPE..
any server settings etc..
Thanks in advance,,
Sunil Bansal
18 years ago
JSP
Hello Chris,
what is this jspsmartupload or multipartrequest?
can u tell from where i can get this or send me at my id
sunilkbansal@indiatimes.com
thanks
Sunil Bansal
18 years ago
JSP
Hello Chris,
actully I want to upload a file from any client m/c to server.
I cud not find the way to upload file to server.
in the above code, I m prefxing remote host m/c to the file name selected by the client in browser.
and the removing ":" from it..
say if file selected by user is
C:\some_folder\abc.doc
and his m/c address is, 89.0.0.876
i m trying to make this as,
//89.0.0.876/C/some_folder/abc.doc
then upload that file to server using input stream and outputstream.. but it seems it is not working..
can u help me in uploading a file from client m/c to server..
a sample code will be very helpful
Thanks..
Sunil Bansal
18 years ago
JSP
Hello Christian,
Thanks
it works...
i m facing onw more problem...
uptill now i was testing uploading of file from my m/c only .. means client and server was on same m/c
today i tried to upload from my colleague's m/c,
from 1 m/c it is working, i tried from 2-3 m/c more and it is not working..
but could be the reason.... here below is my code sample..
file_name="//"+request.getRemoteHost()+"/"+file_name;
int o=file_name.indexOf(':');
file_name=file_name.substring(0,o)+file_name.substring(o+1);
file_name=file_name.replace('\\','/');
int f=file_name.lastIndexOf("/");
newdemopath=file_name.substring(f+1);
int y;
String upload_file = application.getRealPath("/bhi/brochures/"+newdemopath);
FileInputStream fis = new FileInputStream(new File(file_name));
FileOutputStream fos = new FileOutputStream(new File(upload_file));
do
{
y=fis.read();
if(y !=-1)
fos.write(y);
}while(y !=-1);
fos.close();
fis.close();
thanks for help..
Sunil Bansal
18 years ago
JSP
Hi Guys,
I want to upload a file from client to server
i m using tomcat server..
if i need to upload a file I need t give path like this in
FileOutputStream fos = new FileOutputStream(new File("../webapps/examples/bhi/demos/"+file_to_upload));
my JSPs are in bhi folder. I have one more folder demos in bhi, i want to upload files into that..
by above i can upload the file..
but now if I switch to weblogic server.. this above "../webapps/examples/bhi/demos/" will not work..
in weblogic i hv put my JSPs in weblogic/myserver/public_html/bhi.., hence works
now please tell me, what path i shud write that my file get uploaded in right folder under, where my JSPs are..., which ever Server I choose
i hope u understand my problem, please give me the solution.. for independent of server
Thanks in anticipation.
Sunil Bansal
[ June 04, 2003: Message edited by: Sunil K Bansal ]
18 years ago
JSP
Hi Guys,
I am using java mail Api to send mails.
I m using my proxy server's settings for that.
I can send mails.
but let us say my domain name is abcd.com
i can send mails to only where email id ends with abcd.com
but if i change it to anyother like my hotmail id the following exception is thrown
Sending failed;
nested exception is:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
javax.mail.SendFailedException: 550 5.7.1 <sunilkbansal@hotmail.com>... we do not relay <info@abcd.com>
but could be the reason and what is the solution.
Thanks in Advance..
Sunil Bansal
18 years ago
JSP
Hi Guys,
is it possible to show file name alrady stored in database into <input type=file .... >
it has value attribute, but it do not allow to set the value, or u can say it do not show the value
as I m writing this in my JSP
<input type="file" name="img_file" size="30" accept="image/gif,image/jpeg" value="<%=file_name%>">
i want to show value in file_name variable, which got its value from database, into input type file..
but I m not able to...
i think value attribute in <input type=file is read only.. is it??
Is there anyway to set the value ...
I hope u understand, what I want??
kindly reply me ASAP.
Actually I just want to save this file name in database column. and I also want to upload this file in a particular folder on the Server.
Kindly help me on this also how to upload a file to a folder on a server thru JSP/Java..
thanks in anticipation...
Sunil Bansal
18 years ago
JSP
Hi
I made changes in web.xml file in conf folder as
<!-- Establish the default MIME type mappings -->
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
even then I m not able to send text/html mails
may be i m checking at wrong file.
can anybody tell me where I need to make changes
thanx
Bansal
19 years ago
JSP
HI
Thanx
I m using the same method with correct arguments(I suppose) .
I think this is the problem with Tomcat as same code is working fine on one computer but not working on another computer.
Bansal
19 years ago
JSP
Hi
suppose i dont have/need any jsp coding in my pages.
means i have only html pages then
why it is (include) not working in Tomcat.
as it is wrking in IIS
i want to know is there any problem with Tomact
thanx
Bansal
19 years ago
JSP
Hi Guys
i m using following html include tag in my jsp/html pages
<!--#include file="./includes/header.txt" -->
but this is not working.
i m using tomcat 4
is this the problem with tomcat? how to correct it?
as my html pages are working fine on IIS with this tag.
kindly guide me
thanx in advance
Bansal
19 years ago
JSP
Hi
I have tomcat installed on two computers.
I m using java mail in JSP and servlets.
on one computer it allowes me to send mail with mime type "text/html", but on other computer it allows me mail with "text/plain"
where is the problem
i hv set default setting in web.xml in conf folder of tomcat like this
<!-- Establish the default MIME type mappings -->
<mime-mapping>
<extension>txt</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
even then it is not allowing me to send text/html mails
kindly guide me
thanx and regards
Bansal
19 years ago
JSP
Hi,
is there any difference in JSP and Servlets.
response.sendReDirect() is working fine in Servlets
but giving me bad out put in JSPs
kindly explain me ....
thanx
Bansal
19 years ago
JSP
Hi
I have tomcat installed on two computers.
I m using java mail in JSP and servlets.
on one computer it allowes me to send mail with mime type "text/html", but on other computer it allows me mail with "text/plain"
where is the problem
kindly guide me
tahnx and regards
Bansal
19 years ago
Hi,
I tried both resonse.sendRedirect() and jsp:forward tag.
I come to know that using sendRedirect() previous parameters are not passed to redirected page and the URL changes.
with JSP forward tag previous parameters are passed to the forwarded page but URL do not change.
I m using tomcat 4 but on actually when I applied
response.sendRidirect() i m getting very bad output. output from previous page and redirected page.
where is the problem
thanx and regards
Bansal
19 years ago
JSP